diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-07 20:45:45 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-07 20:45:45 +0200 |
commit | 4f4d230dac936f32cceb8be35fe09822d85bb2b6 (patch) | |
tree | a180a736708834708e0e5b95fd1720f37722b429 /src/common/file_util.cpp | |
parent | Merge pull request #695 from Subv/crash_f (diff) | |
parent | Fix printf format warning (diff) | |
download | yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar.gz yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar.bz2 yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar.lz yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar.xz yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.tar.zst yuzu-4f4d230dac936f32cceb8be35fe09822d85bb2b6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/file_util.cpp | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 4ef4918d7..7cdd1484f 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -2,42 +2,52 @@ // 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 <windows.h> -#include <shlobj.h> // for SHGetFolderPath -#include <shellapi.h> -#include <commdlg.h> // for GetSaveFileName -#include <io.h> -#include <direct.h> // getcwd -#include <tchar.h> + #include <windows.h> + #include <shlobj.h> // for SHGetFolderPath + #include <shellapi.h> + #include <commdlg.h> // for GetSaveFileName + #include <io.h> + #include <direct.h> // getcwd + #include <tchar.h> + + // 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 <sys/param.h> -#include <sys/types.h> -#include <dirent.h> -#include <pwd.h> -#include <unistd.h> + #include <sys/param.h> + #include <sys/types.h> + #include <dirent.h> + #include <pwd.h> + #include <unistd.h> #endif #if defined(__APPLE__) -#include <CoreFoundation/CFString.h> -#include <CoreFoundation/CFURL.h> -#include <CoreFoundation/CFBundle.h> + #include <CoreFoundation/CFString.h> + #include <CoreFoundation/CFURL.h> + #include <CoreFoundation/CFBundle.h> #endif #include <algorithm> #include <sys/stat.h> #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. @@ -589,7 +599,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 +613,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__) |