Merge pull request #6051 from JosJuice/android-sys

Android: Extract Sys to a different folder than the User folder
This commit is contained in:
JosJuice
2017-12-27 17:34:24 +01:00
committed by GitHub
9 changed files with 149 additions and 90 deletions

View File

@ -27,21 +27,6 @@
#define DOLPHIN_DATA_DIR "dolphin-emu"
#endif
// Shared data dirs (Sys and shared User for Linux)
#if defined(_WIN32) || defined(LINUX_LOCAL_DEV)
#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"
#else
#define SYSDATA_DIR "sys"
#endif
#endif
// Dirs in both User and Sys
#define EUR_DIR "EUR"
#define USA_DIR "USA"

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)
{
@ -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)
{

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)