We dont need that

This commit is contained in:
boludoz 2023-10-27 00:30:35 -03:00
parent b5415b6872
commit 7f62a48ab5
1 changed files with 19 additions and 15 deletions

View File

@ -6,7 +6,6 @@
#include <unordered_map> #include <unordered_map>
#include "common/fs/fs.h" #include "common/fs/fs.h"
#include "common/string_util.h"
#ifdef ANDROID #ifdef ANDROID
#include "common/fs/fs_android.h" #include "common/fs/fs_android.h"
#endif #endif
@ -15,7 +14,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef _WIN32 #ifdef _WIN32
#include <shlobj.h> // Used in GetExeDirectory() and GetWindowsDesktop() #include <shlobj.h> // Used in GetExeDirectory()
#else #else
#include <cstdlib> // Used in Get(Home/Data)Directory() #include <cstdlib> // Used in Get(Home/Data)Directory()
#include <pwd.h> // Used in GetHomeDirectory() #include <pwd.h> // Used in GetHomeDirectory()
@ -251,25 +250,30 @@ void SetYuzuPath(YuzuPath yuzu_path, const fs::path& new_path) {
#ifdef _WIN32 #ifdef _WIN32
fs::path GetExeDirectory() { fs::path GetExeDirectory() {
WCHAR exe_path[MAX_PATH]; wchar_t exe_path[MAX_PATH];
if (SUCCEEDED(GetModuleFileNameW(nullptr, exe_path, MAX_PATH))) {
std::wstring wide_exe_path(exe_path); if (GetModuleFileNameW(nullptr, exe_path, MAX_PATH) == 0) {
return fs::path{Common::UTF16ToUTF8(wide_exe_path)}.parent_path(); LOG_ERROR(Common_Filesystem,
"Failed to get the path to the executable of the current process");
} }
LOG_ERROR(Common_Filesystem, "Failed to get the path to the executable of the current "
"process"); return fs::path{exe_path}.parent_path();
return fs::path{};
} }
fs::path GetAppDataRoamingDirectory() { fs::path GetAppDataRoamingDirectory() {
PWSTR appdata_roaming_path = nullptr; PWSTR appdata_roaming_path = nullptr;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &appdata_roaming_path))) {
std::wstring wide_appdata_roaming_path(appdata_roaming_path); SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &appdata_roaming_path);
CoTaskMemFree(appdata_roaming_path);
return fs::path{Common::UTF16ToUTF8(wide_appdata_roaming_path)}; auto fs_appdata_roaming_path = fs::path{appdata_roaming_path};
CoTaskMemFree(appdata_roaming_path);
if (fs_appdata_roaming_path.empty()) {
LOG_ERROR(Common_Filesystem, "Failed to get the path to the %APPDATA% directory");
} }
LOG_ERROR(Common_Filesystem, "Failed to get the path to the %APPDATA% directory");
return fs::path{}; return fs_appdata_roaming_path;
} }
#else #else