Android: Extract Sys to a different folder than the User folder

This commit is contained in:
JosJuice
2017-09-09 11:27:24 +02:00
parent d1c1793a34
commit b3b7aef09a
7 changed files with 96 additions and 54 deletions

View File

@ -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)
{
@ -696,8 +701,6 @@ std::string GetSysDirectory()
#define SYSDATA_DIR "Sys"
#elif defined __APPLE__
#define SYSDATA_DIR "Contents/Resources/Sys"
#elif defined ANDROID
#define SYSDATA_DIR "/sdcard/dolphin-emu"
#else
#ifdef DATA_DIR
#define SYSDATA_DIR DATA_DIR "sys"
@ -710,6 +713,9 @@ std::string GetSysDirectory()
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
@ -719,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)
{

View File

@ -183,6 +183,10 @@ std::string GetThemeDir(const std::string& theme_name);
// Returns the path to where the sys file are
std::string GetSysDirectory();
#ifdef ANDROID
void SetSysDirectory(const std::string& path);
#endif
#ifdef __APPLE__
std::string GetBundleDirectory();
#endif

View File

@ -77,7 +77,9 @@ void CreateDirectories()
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX));
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX) + ANAGLYPH_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
#ifndef ANDROID
File::CreateFullPath(File::GetUserPath(D_THEMES_IDX));
#endif
}
void SetUserDirectory(const std::string& custom_path)