From 2c8b485ba0635990d7b95b82bf86da32db33e1ab Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 29 Aug 2014 17:06:58 +0400 Subject: [PATCH] Compilation fix 4 --- Utilities/GNU.h | 1 - Utilities/rFile.cpp | 12 ++++++++++-- Utilities/rPlatform.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Utilities/GNU.h b/Utilities/GNU.h index 4087004e4f..43b00feafc 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -34,7 +34,6 @@ void strcpy_trunc(char (&dst)[size], const std::string& src) #define _byteswap_ushort(x) __builtin_bswap16(x) #define _byteswap_ulong(x) __builtin_bswap32(x) #define _byteswap_uint64(x) __builtin_bswap64(x) -#define mkdir(x) mkdir(x, 0777) #define INFINITE 0xFFFFFFFF #define _CRT_ALIGN(x) __attribute__((aligned(x))) #define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val) diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp index 7608f0e4c1..302813e50a 100644 --- a/Utilities/rFile.cpp +++ b/Utilities/rFile.cpp @@ -66,7 +66,11 @@ bool rIsDir(const std::string &filename) { bool rMkdir(const std::string &dir) { - return !mkdir(dir.c_str()); +#ifdef _WIN32 + return !_mkdir(dir.c_str()); +#else + return !mkdir(dir.c_str(), 0777); +#endif } bool rMkpath(const std::string &path) @@ -83,7 +87,11 @@ bool rMkpath(const std::string &path) start = pos; if(dir.size() == 0) continue; - if((ret = mkdir(dir.c_str())) && errno != EEXIST){ +#ifdef _WIN32 + if((ret = _mkdir(dir.c_str())) && errno != EEXIST){ +#else + if((ret = mkdir(dir.c_str(), 0777)) && errno != EEXIST){ +#endif return !ret; } if (pos >= path.length()) diff --git a/Utilities/rPlatform.cpp b/Utilities/rPlatform.cpp index c6b86dd77b..c246692d60 100644 --- a/Utilities/rPlatform.cpp +++ b/Utilities/rPlatform.cpp @@ -48,7 +48,7 @@ std::string rPlatform::getConfigDir() else // Just in case dir = "./config"; dir = dir + "/rpcs3/"; - mkdir(dir.c_str()); + mkdir(dir.c_str(), 0777); #endif } return dir;