Fix crash when trying to open unreadable IWAD files

This commit is contained in:
Cacodemon345 2021-02-12 11:52:26 +06:00 committed by Christoph Oelckers
commit 349a2e9235
3 changed files with 20 additions and 2 deletions

View file

@ -165,6 +165,23 @@ bool FileExists (const char *filename)
return res && !isdir;
}
//==========================================================================
//
// FileReadable
//
// Returns true if the file can be read.
//
//==========================================================================
bool FileReadable(const char *filename)
{
#ifndef _WIN32
return access (filename, R_OK) == 0;
#else
return _access (filename, 4) == 0;
#endif
}
//==========================================================================
//
// DirExists