define S_ISDIR for win32 #94

Followup on #383.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-03-06 18:49:31 -08:00
parent 7373da1528
commit 6a98f3c200
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 9 additions and 3 deletions

View File

@ -40,7 +40,10 @@ extern "C" {
#define snprintf sprintf #define snprintf sprintf
#define stat _stat #define stat _stat
#define mkdir(X,Y) (_mkdir(X)) #define mkdir(X,Y) (_mkdir(X))
#define S_ISDIR _S_IFDIR // from: https://www.linuxquestions.org/questions/programming-9/porting-to-win32-429334/
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
#endif
#endif // _WIN32 #endif // _WIN32
#ifndef __GNUC__ #ifndef __GNUC__
@ -679,7 +682,7 @@ const char* FindConfigFile(const char *name)
while (tok) { while (tok) {
sprintf(path, "%s%c%s", tok, FILE_SEP, EXE_NAME); sprintf(path, "%s%c%s", tok, FILE_SEP, EXE_NAME);
if (FileExists(path)) { if (FileExists(path)) {
char path2[2048]; static char path2[2048];
sprintf(path2, "%s%c%s", tok, FILE_SEP, name); sprintf(path2, "%s%c%s", tok, FILE_SEP, name);
if (FileExists(path2)) { if (FileExists(path2)) {
return path2; return path2;

View File

@ -73,7 +73,10 @@
#define snprintf sprintf #define snprintf sprintf
#define stat _stat #define stat _stat
#define mkdir(X,Y) (_mkdir(X)) #define mkdir(X,Y) (_mkdir(X))
#define S_ISDIR _S_IFDIR // from: https://www.linuxquestions.org/questions/programming-9/porting-to-win32-429334/
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
#endif
#endif // _WIN32 #endif // _WIN32
#ifndef __GNUC__ #ifndef __GNUC__