Fix crash when trying to open unreadable IWAD files
This commit is contained in:
parent
0a30c19138
commit
349a2e9235
3 changed files with 20 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue