diff options
| author | 2023-10-16 23:42:45 -0300 | |
|---|---|---|
| committer | 2023-10-16 23:42:45 -0300 | |
| commit | 1afe6d51eed4a420bb7289955333a2bb10c06b99 (patch) | |
| tree | b1baaf7033bff02d09132c136010802499cd3792 /src/common/fs/path_util.cpp | |
| parent | shortcut_stream.close(); fixed (diff) | |
| download | yuzu-1afe6d51eed4a420bb7289955333a2bb10c06b99.tar.gz yuzu-1afe6d51eed4a420bb7289955333a2bb10c06b99.tar.xz yuzu-1afe6d51eed4a420bb7289955333a2bb10c06b99.zip | |
More @liamwhite suggestions applied.
Diffstat (limited to 'src/common/fs/path_util.cpp')
| -rw-r--r-- | src/common/fs/path_util.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index 60c5e477e..732c1559f 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp | |||
| @@ -252,29 +252,23 @@ void SetYuzuPath(YuzuPath yuzu_path, const fs::path& new_path) { | |||
| 252 | 252 | ||
| 253 | fs::path GetExeDirectory() { | 253 | fs::path GetExeDirectory() { |
| 254 | WCHAR exe_path[MAX_PATH]; | 254 | WCHAR exe_path[MAX_PATH]; |
| 255 | |||
| 256 | if (SUCCEEDED(GetModuleFileNameW(nullptr, exe_path, MAX_PATH))) { | 255 | if (SUCCEEDED(GetModuleFileNameW(nullptr, exe_path, MAX_PATH))) { |
| 257 | std::wstring wide_exe_path(exe_path); | 256 | std::wstring wide_exe_path(exe_path); |
| 258 | return fs::path{Common::UTF16ToUTF8(wide_exe_path)}.parent_path(); | 257 | return fs::path{Common::UTF16ToUTF8(wide_exe_path)}.parent_path(); |
| 259 | } else { | ||
| 260 | LOG_ERROR(Common_Filesystem, "Failed to get the path to the executable of the current " | ||
| 261 | "process"); | ||
| 262 | } | 258 | } |
| 263 | 259 | LOG_ERROR(Common_Filesystem, "Failed to get the path to the executable of the current " | |
| 260 | "process"); | ||
| 264 | return fs::path{}; | 261 | return fs::path{}; |
| 265 | } | 262 | } |
| 266 | 263 | ||
| 267 | fs::path GetAppDataRoamingDirectory() { | 264 | fs::path GetAppDataRoamingDirectory() { |
| 268 | PWSTR appdata_roaming_path = nullptr; | 265 | PWSTR appdata_roaming_path = nullptr; |
| 269 | |||
| 270 | if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &appdata_roaming_path))) { | 266 | if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &appdata_roaming_path))) { |
| 271 | std::wstring wide_appdata_roaming_path(appdata_roaming_path); | 267 | std::wstring wide_appdata_roaming_path(appdata_roaming_path); |
| 272 | CoTaskMemFree(appdata_roaming_path); | 268 | CoTaskMemFree(appdata_roaming_path); |
| 273 | return fs::path{Common::UTF16ToUTF8(wide_appdata_roaming_path)}; | 269 | return fs::path{Common::UTF16ToUTF8(wide_appdata_roaming_path)}; |
| 274 | } else { | ||
| 275 | LOG_ERROR(Common_Filesystem, "Failed to get the path to the %APPDATA% directory"); | ||
| 276 | } | 270 | } |
| 277 | 271 | LOG_ERROR(Common_Filesystem, "Failed to get the path to the %APPDATA% directory"); | |
| 278 | return fs::path{}; | 272 | return fs::path{}; |
| 279 | } | 273 | } |
| 280 | 274 | ||