diff options
| author | JosJuice <josjuice@gmail.com> | 2017-12-27 17:34:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-27 17:34:24 +0100 |
| commit | 1df69c57507dbeea638eceac1c7410b737f1739c (patch) | |
| tree | b0ad19e5bfbd175ca4523f923531d332504b5592 /Source/Core/Common/FileUtil.cpp | |
| parent | 3bc61ed3635f5932cad8b460812ad8545aada4da (diff) | |
| parent | 152f7fa35c0647f5203bf644959291bbaebd0f3c (diff) | |
Merge pull request #6051 from JosJuice/android-sys
Android: Extract Sys to a different folder than the User folder
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 78141d6095..e798826cf5 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -13,6 +13,7 @@ #include <sys/stat.h> #include <vector> +#include "Common/Assert.h" #include "Common/Common.h" #include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" @@ -52,6 +53,10 @@ // REMEMBER: strdup considered harmful! namespace File { +#ifdef ANDROID +static std::string s_android_sys_directory; +#endif + #ifdef _WIN32 FileInfo::FileInfo(const std::string& path) { @@ -692,10 +697,25 @@ std::string GetSysDirectory() { std::string sysDir; +#if defined(_WIN32) || defined(LINUX_LOCAL_DEV) +#define SYSDATA_DIR "Sys" +#elif defined __APPLE__ +#define SYSDATA_DIR "Contents/Resources/Sys" +#else +#ifdef DATA_DIR +#define SYSDATA_DIR DATA_DIR "sys" +#else +#define SYSDATA_DIR "sys" +#endif +#endif + #if defined(__APPLE__) sysDir = GetBundleDirectory() + DIR_SEP + SYSDATA_DIR; #elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR; +#elif defined ANDROID + sysDir = s_android_sys_directory; + _assert_msg_(COMMON, !sysDir.empty(), "Sys directory has not been set"); #else sysDir = SYSDATA_DIR; #endif @@ -705,6 +725,14 @@ std::string GetSysDirectory() return sysDir; } +#ifdef ANDROID +void SetSysDirectory(const std::string& path) +{ + INFO_LOG(COMMON, "Setting Sys directory to %s", path.c_str()); + s_android_sys_directory = path; +} +#endif + static std::string s_user_paths[NUM_PATH_INDICES]; static void RebuildUserDirectories(unsigned int dir_index) { |
