mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 23:06:23 -05:00
common/fs/path_util: Slightly refactor PathManagerImpl's constructor
This moves all GenerateYuzuPath calls outside of the platofrm-specific #ifdefs, replacing them with assignments to paths.
This commit is contained in:
parent
2a77c29c6d
commit
0b8a7ca213
1 changed files with 15 additions and 12 deletions
|
@ -82,32 +82,35 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PathManagerImpl() {
|
PathManagerImpl() {
|
||||||
|
fs::path yuzu_path;
|
||||||
|
fs::path yuzu_path_cache;
|
||||||
|
fs::path yuzu_path_config;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
auto yuzu_path = GetExeDirectory() / PORTABLE_DIR;
|
yuzu_path = GetExeDirectory() / PORTABLE_DIR;
|
||||||
|
|
||||||
if (!IsDir(yuzu_path)) {
|
if (!IsDir(yuzu_path)) {
|
||||||
yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
|
yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
|
yuzu_path_cache = yuzu_path / CACHE_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR);
|
yuzu_path_config = yuzu_path / CONFIG_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
|
|
||||||
#else
|
#else
|
||||||
auto yuzu_path = GetCurrentDir() / PORTABLE_DIR;
|
yuzu_path = GetCurrentDir() / PORTABLE_DIR;
|
||||||
|
|
||||||
if (Exists(yuzu_path) && IsDir(yuzu_path)) {
|
if (Exists(yuzu_path) && IsDir(yuzu_path)) {
|
||||||
GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
|
yuzu_path_cache = yuzu_path / CACHE_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR);
|
yuzu_path_config = yuzu_path / CONFIG_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
|
|
||||||
} else {
|
} else {
|
||||||
yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
|
yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
|
||||||
|
yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
|
yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR;
|
||||||
GenerateYuzuPath(YuzuPath::CacheDir, GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR);
|
|
||||||
GenerateYuzuPath(YuzuPath::ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
|
||||||
|
GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache);
|
||||||
|
GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config);
|
||||||
GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
|
GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
|
||||||
GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
|
GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
|
||||||
GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);
|
GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);
|
||||||
|
|
Loading…
Reference in a new issue