Skip to content
Permalink
Browse files

Use XDG Directory Specification for Linux. See: http://standards.free…

…desktop.org/basedir-spec/basedir-spec-latest.html

Means that everyone will have to manually move their existing config's.
Fixes #4623
  • Loading branch information...
xsacha committed Nov 24, 2013
1 parent aa37a06 commit 132fe47c7df374639a0d226ffeedfb29c5976ac5
Showing with 18 additions and 6 deletions.
  1. +11 −2 Qt/QtHost.cpp
  2. +7 −4 UI/NativeApp.cpp
@@ -243,15 +243,24 @@ 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()));
VFSRegister("", new AssetsAssetReader());

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();
@@ -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/";

0 comments on commit 132fe47

Please sign in to comment.
You can’t perform that action at this time.