summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Creak2021-10-11 21:56:25 -0400
committerGravatar GitHub2021-10-11 21:56:25 -0400
commit0b8a7ca2138de7601de4e63816305688b94041c7 (patch)
treed2e716bc3da9cd619c577048b6ba4768b30e1e2e
parentMerge pull request #7161 from MightyCreak/fix-some-warnings (diff)
downloadyuzu-0b8a7ca2138de7601de4e63816305688b94041c7.tar.gz
yuzu-0b8a7ca2138de7601de4e63816305688b94041c7.tar.xz
yuzu-0b8a7ca2138de7601de4e63816305688b94041c7.zip
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.
Diffstat (limited to '')
-rw-r--r--src/common/fs/path_util.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp
index 43b79bd6d..1bcb897b5 100644
--- a/src/common/fs/path_util.cpp
+++ b/src/common/fs/path_util.cpp
@@ -82,32 +82,35 @@ public:
82 82
83private: 83private:
84 PathManagerImpl() { 84 PathManagerImpl() {
85 fs::path yuzu_path;
86 fs::path yuzu_path_cache;
87 fs::path yuzu_path_config;
88
85#ifdef _WIN32 89#ifdef _WIN32
86 auto yuzu_path = GetExeDirectory() / PORTABLE_DIR; 90 yuzu_path = GetExeDirectory() / PORTABLE_DIR;
87 91
88 if (!IsDir(yuzu_path)) { 92 if (!IsDir(yuzu_path)) {
89 yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; 93 yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
90 } 94 }
91 95
92 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 96 yuzu_path_cache = yuzu_path / CACHE_DIR;
93 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); 97 yuzu_path_config = yuzu_path / CONFIG_DIR;
94 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
95#else 98#else
96 auto yuzu_path = GetCurrentDir() / PORTABLE_DIR; 99 yuzu_path = GetCurrentDir() / PORTABLE_DIR;
97 100
98 if (Exists(yuzu_path) && IsDir(yuzu_path)) { 101 if (Exists(yuzu_path) && IsDir(yuzu_path)) {
99 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 102 yuzu_path_cache = yuzu_path / CACHE_DIR;
100 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); 103 yuzu_path_config = yuzu_path / CONFIG_DIR;
101 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
102 } else { 104 } else {
103 yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR; 105 yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
104 106 yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR;
105 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 107 yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR;
106 GenerateYuzuPath(YuzuPath::CacheDir, GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR);
107 GenerateYuzuPath(YuzuPath::ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR);
108 } 108 }
109#endif 109#endif
110 110
111 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
112 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache);
113 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config);
111 GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR); 114 GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
112 GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR); 115 GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
113 GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR); 116 GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);