mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-30 02:39:17 -05:00
REVIEWED: FileExists(), using macro
This commit is contained in:
@ -205,11 +205,13 @@
|
|||||||
#define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir()
|
#define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir()
|
||||||
#define CHDIR _chdir
|
#define CHDIR _chdir
|
||||||
#define MKDIR(dir) _mkdir(dir)
|
#define MKDIR(dir) _mkdir(dir)
|
||||||
|
#define ACCESS(fn) _access(fn, 0)
|
||||||
#else
|
#else
|
||||||
#include <unistd.h> // Required for: getch(), chdir(), mkdir(), access()
|
#include <unistd.h> // Required for: getch(), chdir(), mkdir(), access()
|
||||||
#define GETCWD getcwd
|
#define GETCWD getcwd
|
||||||
#define CHDIR chdir
|
#define CHDIR chdir
|
||||||
#define MKDIR(dir) mkdir(dir, 0777)
|
#define MKDIR(dir) mkdir(dir, 0777)
|
||||||
|
#define ACCESS(fn) access(fn, F_OK)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -1972,11 +1974,7 @@ bool FileExists(const char *fileName)
|
|||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
if (ACCESS(fileName) != -1) result = true;
|
||||||
if (_access(fileName, 0) != -1) result = true;
|
|
||||||
#else
|
|
||||||
if (access(fileName, F_OK) != -1) result = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: Alternatively, stat() can be used instead of access()
|
// NOTE: Alternatively, stat() can be used instead of access()
|
||||||
//#include <sys/stat.h>
|
//#include <sys/stat.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user