mirror of
https://github.com/RetroDECK/io.github.shiiion.primehack.git
synced 2024-12-04 19:15:39 +00:00
Merge pull request #5 from cpba/detectflatpak
Detect flatpak rather than forcing xdg
This commit is contained in:
commit
f54f6b3085
40
detectflatpak.patch
Normal file
40
detectflatpak.patch
Normal file
|
@ -0,0 +1,40 @@
|
|||
commit d4c899cede0743d40934ca11f83691cda72ff9dd
|
||||
Author: Carles Pastor <cpbadosa@gmail.com>
|
||||
Date: Sat Apr 2 20:47:06 2022 +0200
|
||||
|
||||
Detect when running inside a flatpak sandbox
|
||||
|
||||
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
|
||||
index cb857fd3c7..e3ddde24fb 100644
|
||||
--- a/Source/Core/UICommon/UICommon.cpp
|
||||
+++ b/Source/Core/UICommon/UICommon.cpp
|
||||
@@ -309,24 +309,25 @@ void SetUserDirectory(std::string custom_path)
|
||||
// We are on a non-Apple and non-Android POSIX system, there are 4 cases:
|
||||
// 1. GetExeDirectory()/portable.txt exists
|
||||
// -> Use GetExeDirectory()/User
|
||||
- // 2. $DOLPHIN_EMU_USERPATH is set
|
||||
+ // 2. $DOLPHIN_EMU_USERPATH is set, and we're not in flatpak
|
||||
// -> Use $DOLPHIN_EMU_USERPATH
|
||||
- // 3. ~/.dolphin-emu directory exists
|
||||
+ // 3. ~/.dolphin-emu directory exists, and we're not in flatpak
|
||||
// -> Use ~/.dolphin-emu
|
||||
// 4. Default
|
||||
// -> Use XDG basedir, see
|
||||
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
user_path = home_path + "." DOLPHIN_DATA_DIR DIR_SEP;
|
||||
std::string exe_path = File::GetExeDirectory();
|
||||
+ bool flatpak = File::Exists("/.flatpak-info");
|
||||
if (File::Exists(exe_path + DIR_SEP "portable.txt"))
|
||||
{
|
||||
user_path = exe_path + DIR_SEP "User" DIR_SEP;
|
||||
}
|
||||
- else if (env_path)
|
||||
+ else if (env_path && !flatpak)
|
||||
{
|
||||
user_path = env_path;
|
||||
}
|
||||
- else if (!File::Exists(user_path))
|
||||
+ else if (flatpak || !File::Exists(user_path))
|
||||
{
|
||||
const char* data_home = getenv("XDG_DATA_HOME");
|
||||
std::string data_path =
|
|
@ -1,45 +0,0 @@
|
|||
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
|
||||
index 2055c4d863..163a15f8a5 100644
|
||||
--- a/Source/Core/UICommon/UICommon.cpp
|
||||
+++ b/Source/Core/UICommon/UICommon.cpp
|
||||
@@ -273,28 +273,11 @@ void SetUserDirectory(const std::string& custom_path)
|
||||
user_path = home_path + DOLPHIN_DATA_DIR DIR_SEP;
|
||||
}
|
||||
#else
|
||||
- // We are on a non-Apple and non-Android POSIX system, there are 4 cases:
|
||||
- // 1. GetExeDirectory()/portable.txt exists
|
||||
- // -> Use GetExeDirectory()/User
|
||||
- // 2. $DOLPHIN_EMU_USERPATH is set
|
||||
- // -> Use $DOLPHIN_EMU_USERPATH
|
||||
- // 3. ~/.dolphin-emu directory exists
|
||||
- // -> Use ~/.dolphin-emu
|
||||
// 4. Default
|
||||
// -> Use XDG basedir, see
|
||||
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
user_path = home_path + "." DOLPHIN_DATA_DIR DIR_SEP;
|
||||
std::string exe_path = File::GetExeDirectory();
|
||||
- if (File::Exists(exe_path + DIR_SEP "portable.txt"))
|
||||
- {
|
||||
- user_path = exe_path + DIR_SEP "User" DIR_SEP;
|
||||
- }
|
||||
- else if (env_path)
|
||||
- {
|
||||
- user_path = env_path;
|
||||
- }
|
||||
- else if (!File::Exists(user_path))
|
||||
- {
|
||||
const char* data_home = getenv("XDG_DATA_HOME");
|
||||
std::string data_path =
|
||||
std::string(data_home && data_home[0] == '/' ? data_home :
|
||||
@@ -316,11 +299,9 @@ void SetUserDirectory(const std::string& custom_path)
|
||||
File::SetUserPath(D_CONFIG_IDX, config_path);
|
||||
File::SetUserPath(D_CACHE_IDX, cache_path);
|
||||
return;
|
||||
- }
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
- File::SetUserPath(D_USER_IDX, std::move(user_path));
|
||||
}
|
||||
|
||||
void SaveWiimoteSources()
|
|
@ -110,11 +110,13 @@ modules:
|
|||
- type: git
|
||||
url: https://github.com/shiiion/dolphin.git
|
||||
commit: 9ca0eb888bd6f8ed13a4efb92d808fbf0705ffa4
|
||||
# detects whether dolphin is running in a flatpak sandbox
|
||||
# and makes it use xdg directories if it is.
|
||||
# prevents dolphin from attempting to write conf files
|
||||
# in non-writable paths, typically happens when a user
|
||||
# has leftover files from a previous non-flatpak install
|
||||
- type: patch
|
||||
path: forcexdg.patch
|
||||
path: detectflatpak.patch
|
||||
# version strings must match exactly for online multiplayer
|
||||
- type: patch
|
||||
path: nodirtyversion.patch
|
||||
|
|
Loading…
Reference in a new issue