mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Fix not closing description.txt and fix path seperator
0 length description.txt files were not closed.
This commit is contained in:
parent
51743bbb01
commit
da861ff3a2
1 changed files with 6 additions and 3 deletions
|
@ -2491,20 +2491,23 @@ void FS_GetModDescription( const char *modDir, char *description, int descriptio
|
||||||
int nDescLen;
|
int nDescLen;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
Com_sprintf( descPath, sizeof ( descPath ), "%s/description.txt", modDir );
|
Com_sprintf( descPath, sizeof ( descPath ), "%s%cdescription.txt", modDir, PATH_SEP );
|
||||||
nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
|
nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
|
||||||
|
|
||||||
if ( nDescLen > 0 && descHandle ) {
|
if ( nDescLen > 0 ) {
|
||||||
file = FS_FileForHandle(descHandle);
|
file = FS_FileForHandle(descHandle);
|
||||||
Com_Memset( description, 0, descriptionLen );
|
Com_Memset( description, 0, descriptionLen );
|
||||||
nDescLen = fread(description, 1, descriptionLen, file);
|
nDescLen = fread(description, 1, descriptionLen, file);
|
||||||
if (nDescLen >= 0) {
|
if (nDescLen >= 0) {
|
||||||
description[nDescLen] = '\0';
|
description[nDescLen] = '\0';
|
||||||
}
|
}
|
||||||
FS_FCloseFile(descHandle);
|
|
||||||
} else {
|
} else {
|
||||||
Q_strncpyz( description, modDir, descriptionLen );
|
Q_strncpyz( description, modDir, descriptionLen );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( descHandle ) {
|
||||||
|
FS_FCloseFile( descHandle );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue