- 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:
Randy Heit 2010-03-13 00:08:33 +00:00
parent 1f12c3dd8e
commit cf06cd68bc
1 changed files with 2 additions and 6 deletions

View File

@ -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);
}
//==========================================================================