Store config in the user data config directory (#150)

This commit is contained in:
N3xoX1 2026-08-19 23:16:38 +09:30 committed by GitHub
parent ec96b7cbdb
commit 802abb5b7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 2 additions and 31 deletions

View File

@ -23,7 +23,7 @@ bool AppInit(INotification * notification, const char * baseDirectory, const cha
return false;
}
Path config_path(app_base, "NxEmu.config");
Path config_path(appDirectory, "NxEmu.config");
config_path.AppendDirectory("config");
g_notify = notification;

View File

@ -81,7 +81,7 @@ static void EnablePerMonitorDpiAwareness()
int WINAPI WinMain(_In_ HINSTANCE /*hInstance*/, _In_opt_ HINSTANCE /*hPrevInstance*/, _In_ LPSTR /*lpszArgs*/, _In_ int /*nWinMode*/)
{
EnablePerMonitorDpiAwareness();
bool res = AppInit(&Notification::GetInstance(), Path(Path::MODULE_DIRECTORY), Common::FS::PathToUTF8String(Common::FS::GetDefaultAppStorageDirectory()).c_str());
bool res = AppInit(&Notification::GetInstance(), Path(Path::MODULE_DIRECTORY), Common::FS::GetYuzuPathString(Common::FS::YuzuPath::YuzuDir).c_str());
if (uiSettings.performVulkanCheck)
{

View File

@ -55,27 +55,6 @@ namespace Common::FS {
namespace fs = std::filesystem;
fs::path GetDefaultAppStorageDirectory()
{
#ifdef _WIN32
fs::path yuzu_path = GetExeDirectory() / PORTABLE_DIR;
if (!IsDir(yuzu_path))
{
yuzu_path = GetAppDataRoamingDirectory() / NXEMU_DIR;
}
return yuzu_path;
#elif defined(ANDROID)
return {};
#else
fs::path yuzu_path = GetCurrentDir() / PORTABLE_DIR;
if (Exists(yuzu_path) && IsDir(yuzu_path))
{
return yuzu_path;
}
return GetDataDirectory("XDG_DATA_HOME") / NXEMU_DIR;
#endif
}
/**
* The PathManagerImpl is a singleton allowing to manage the mapping of
* YuzuPath enums to real filesystem paths.

View File

@ -183,14 +183,6 @@ template <typename Path>
}
#endif
/**
* Resolves the default yuzu/nxemu user data root (portable {@code user/} next to the executable,
* or {@code %AppData%/nxemu} on Windows, or XDG paths on Linux).
*
* On Android this returns an empty path; the frontend must supply a directory via SetAppDirectory.
*/
[[nodiscard]] std::filesystem::path GetDefaultAppStorageDirectory();
/**
* Sets the directory used for application storage. Used on Android where we do not know internal
* storage until informed by the frontend.