mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
- Changed FileExists() to use stat instead of fopen/fclose, which ought to be lower
overhead for files that are present. SVN r2206 (trunk)
This commit is contained in:
parent
1f12c3dd8e
commit
cf06cd68bc
1 changed files with 2 additions and 6 deletions
|
@ -148,17 +148,13 @@ int Q_filelength (FILE *f)
|
||||||
|
|
||||||
bool FileExists (const char *filename)
|
bool FileExists (const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
struct stat buff;
|
||||||
|
|
||||||
// [RH] Empty filenames are never there
|
// [RH] Empty filenames are never there
|
||||||
if (filename == NULL || *filename == 0)
|
if (filename == NULL || *filename == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
f = fopen (filename, "r");
|
return stat(filename, &buff) == 0 && !(buff.st_mode & S_IFDIR);
|
||||||
if (!f)
|
|
||||||
return false;
|
|
||||||
fclose (f);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue