From 4260ecdbfcca19dbc6018e8adf9bb59ca82ef8b0 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 10 Mar 2024 14:56:19 +0100 Subject: [PATCH] (Linux and Unix) Made it possible to change the application data directory using the ESDE_APPDATA_DIR environment variable --- es-core/src/utils/FileSystemUtil.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 18ed8a6e9..2b3e377c5 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -252,7 +252,15 @@ namespace Utils return getHomePath(); #else if (FileSystemVariables::sAppDataDirectory.empty()) { +#if !defined(_WIN64) + if (getenv("ESDE_APPDATA_DIR") != nullptr) { + const std::string envAppDataDir {getenv("ESDE_APPDATA_DIR")}; + FileSystemVariables::sAppDataDirectory = expandHomePath(envAppDataDir); + } + else if (Utils::FileSystem::exists(getHomePath() + "/ES-DE")) { +#else if (Utils::FileSystem::exists(getHomePath() + "/ES-DE")) { +#endif FileSystemVariables::sAppDataDirectory = getHomePath() + "/ES-DE"; } else if (Utils::FileSystem::exists(getHomePath() + "/.emulationstation")) {