Browse Source

REVIEWED: `FileExists()`, using macro

pull/5457/head
Ray 1 week ago
parent
commit
0c3e10b262
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      src/rcore.c

+ 3
- 5
src/rcore.c View File

@ -205,11 +205,13 @@
#define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir()
#define CHDIR _chdir
#define MKDIR(dir) _mkdir(dir)
#define ACCESS(fn) _access(fn, 0)
#else
#include <unistd.h> // Required for: getch(), chdir(), mkdir(), access()
#define GETCWD getcwd
#define CHDIR chdir
#define MKDIR(dir) mkdir(dir, 0777)
#define ACCESS(fn) access(fn, F_OK)
#endif
//----------------------------------------------------------------------------------
@ -1972,11 +1974,7 @@ bool FileExists(const char *fileName)
{
bool result = false;
#if defined(_WIN32)
if (_access(fileName, 0) != -1) result = true;
#else
if (access(fileName, F_OK) != -1) result = true;
#endif
if (ACCESS(fileName) != -1) result = true;
// NOTE: Alternatively, stat() can be used instead of access()
//#include <sys/stat.h>

Loading…
Cancel
Save