diff --git a/src/core/host.cpp b/src/core/host.cpp index 4b6f885bc..d2486b4ac 100644 --- a/src/core/host.cpp +++ b/src/core/host.cpp @@ -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. diff --git a/src/core/host.h b/src/core/host.h index 1fbf22473..9a2e4be2e 100644 --- a/src/core/host.h +++ b/src/core/host.h @@ -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();