mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-08 23:34:32 +00:00
Settings: Fix portable mode for AppImages
This commit is contained in:
@@ -30,30 +30,32 @@
|
||||
LOG_CHANNEL(Host);
|
||||
|
||||
namespace Host {
|
||||
|
||||
static std::mutex s_settings_mutex;
|
||||
static LayeredSettingsInterface s_layered_settings_interface;
|
||||
} // namespace Host
|
||||
|
||||
bool Host::Internal::ShouldUsePortableMode()
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
// Check whether portable.ini exists in the program directory.
|
||||
return (FileSystem::FileExists(Path::Combine(EmuFolders::AppRoot, "portable.txt").c_str()) ||
|
||||
FileSystem::FileExists(Path::Combine(EmuFolders::AppRoot, "settings.ini").c_str()));
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string Host::Internal::ComputeDataDirectory()
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
if (ShouldUsePortableMode())
|
||||
#ifndef __ANDROID__
|
||||
// This bullshit here because AppImage mounts in /tmp, so we need to check the "real" appimage location.
|
||||
std::string_view real_approot = EmuFolders::AppRoot;
|
||||
|
||||
#ifdef __linux__
|
||||
if (const char* appimage_path = std::getenv("APPIMAGE"))
|
||||
real_approot = Path::GetDirectory(appimage_path);
|
||||
#endif
|
||||
|
||||
// Check whether portable.ini exists in the program directory.
|
||||
if (FileSystem::FileExists(Path::Combine(real_approot, "portable.txt").c_str()) ||
|
||||
FileSystem::FileExists(Path::Combine(real_approot, "settings.ini").c_str()))
|
||||
{
|
||||
ret = EmuFolders::AppRoot;
|
||||
ret = real_approot;
|
||||
return ret;
|
||||
}
|
||||
#endif // __ANDROID__
|
||||
|
||||
#if defined(_WIN32)
|
||||
// On Windows, use My Documents\DuckStation.
|
||||
|
||||
@@ -100,9 +100,6 @@ void SetFullscreen(bool enabled);
|
||||
|
||||
namespace Internal {
|
||||
|
||||
/// Returns true if the host should use portable mode.
|
||||
bool ShouldUsePortableMode();
|
||||
|
||||
/// Based on the current configuration, determines what the data directory is.
|
||||
std::string ComputeDataDirectory();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user