From bf12f270b3c74f694c789a57cc69f414753ca080 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 22:59:59 -0300 Subject: Common: Remove many unnecessary cross-platform compatibility macros --- src/common/file_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/file_util.cpp') diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 4ef4918d7..25d7d4b9f 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -589,7 +589,7 @@ std::string GetCurrentDir() { char *dir; // Get the current working directory (getcwd uses malloc) - if (!(dir = __getcwd(nullptr, 0))) { + if (!(dir = getcwd(nullptr, 0))) { LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", GetLastErrorMsg()); @@ -603,7 +603,7 @@ std::string GetCurrentDir() // Sets the current directory to the given directory bool SetCurrentDir(const std::string &directory) { - return __chdir(directory.c_str()) == 0; + return chdir(directory.c_str()) == 0; } #if defined(__APPLE__) -- cgit v1.2.3 From f3c096951be57a02467bfda74ab539e69b2eff5e Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 23:06:01 -0300 Subject: Common: Move IO-specific compatibility macros to file_util.cpp --- src/common/file_util.cpp | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'src/common/file_util.cpp') diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 25d7d4b9f..946c4261a 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -7,37 +7,45 @@ #include "common/file_util.h" #ifdef _WIN32 -#include -#include // for SHGetFolderPath -#include -#include // for GetSaveFileName -#include -#include // getcwd -#include + #include + #include // for SHGetFolderPath + #include + #include // for GetSaveFileName + #include + #include // getcwd + #include + + // 64 bit offsets for windows + #define fseeko _fseeki64 + #define ftello _ftelli64 + #define atoll _atoi64 + #define stat64 _stat64 + #define fstat64 _fstat64 + #define fileno _fileno #else -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include #endif #if defined(__APPLE__) -#include -#include -#include + #include + #include + #include #endif #include #include #ifndef S_ISDIR -#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) + #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) #endif #ifdef BSD4_4 -#define stat64 stat -#define fstat64 fstat + #define stat64 stat + #define fstat64 fstat #endif // This namespace has various generic functions related to files and paths. -- cgit v1.2.3 From e1fbac3ca13d37d2625c11d30cfdece4327b446b Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 04:06:12 -0300 Subject: Common: Remove common.h --- src/common/file_util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/common/file_util.cpp') diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 946c4261a..7cdd1484f 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -2,9 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - -#include "common/common.h" +#include "common/assert.h" +#include "common/common_funcs.h" +#include "common/common_paths.h" #include "common/file_util.h" +#include "common/logging/log.h" #ifdef _WIN32 #include -- cgit v1.2.3