diff --git a/Qt/QtHost.cpp b/Qt/QtHost.cpp index e4f29465f..fbe16fb6f 100644 --- a/Qt/QtHost.cpp +++ b/Qt/QtHost.cpp @@ -243,7 +243,16 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co isMessagePending = false; std::string user_data_path = savegame_directory; +#ifdef Q_OS_LINUX + char* config = getenv("XDG_CONFIG_HOME"); + if (!config) { + config = getenv("HOME"); + strcat(config, "/.config"); + } + std::string memcard_path = std::string(config) + "/ppsspp/"; +#else std::string memcard_path = QDir::homePath().toStdString() + "/.ppsspp/"; +#endif VFSRegister("", new DirectoryAssetReader("assets/")); VFSRegister("", new DirectoryAssetReader(user_data_path.c_str())); @@ -251,7 +260,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co g_Config.AddSearchPath(user_data_path); g_Config.AddSearchPath(memcard_path + "PSP/SYSTEM/"); - g_Config.SetDefaultPath(g_Config.memCardDirectory + "PSP/SYSTEM/"); + g_Config.SetDefaultPath(memcard_path + "PSP/SYSTEM/"); g_Config.Load(); i18nrepo.LoadIni(g_Config.sLanguageIni); @@ -305,7 +314,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co g_Config.currentDirectory = QDir::homePath().toStdString(); } - g_Config.memCardDirectory = QDir::homePath().toStdString() + "/.ppsspp/"; + g_Config.memCardDirectory = memcard_path; #if defined(Q_OS_LINUX) std::string program_path = QCoreApplication::applicationDirPath().toStdString(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index c6334b68f..600858eb1 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -249,13 +249,11 @@ void NativeInit(int argc, const char *argv[], // We want this to be FIRST. #ifdef USING_QT_UI VFSRegister("", new AssetsAssetReader()); -#else -#if defined(BLACKBERRY) || defined(IOS) +#elif defined(BLACKBERRY) || defined(IOS) // Packed assets are included in app VFSRegister("", new DirectoryAssetReader(external_directory)); #else VFSRegister("", new DirectoryAssetReader("assets/")); -#endif #endif VFSRegister("", new DirectoryAssetReader(savegame_directory)); @@ -272,7 +270,12 @@ void NativeInit(int argc, const char *argv[], g_Config.memCardDirectory = user_data_path; g_Config.flash0Directory = std::string(external_directory) + "/flash0/"; #elif !defined(_WIN32) - g_Config.memCardDirectory = std::string(getenv("HOME")) + "/.ppsspp/"; + char* config = getenv("XDG_CONFIG_HOME"); + if (!config) { + config = getenv("HOME"); + strcat(config, "/.config"); + } + g_Config.memCardDirectory = std::string(config) + "/ppsspp/"; std::string program_path = File::GetExeDirectory(); if (program_path.empty()) g_Config.flash0Directory = g_Config.memCardDirectory + "/flash0/";