mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +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)
|
||||
{
|
||||
FILE *f;
|
||||
struct stat buff;
|
||||
|
||||
// [RH] Empty filenames are never there
|
||||
if (filename == NULL || *filename == 0)
|
||||
return false;
|
||||
|
||||
f = fopen (filename, "r");
|
||||
if (!f)
|
||||
return false;
|
||||
fclose (f);
|
||||
return true;
|
||||
return stat(filename, &buff) == 0 && !(buff.st_mode & S_IFDIR);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue