From 96a9397349c7b740ef2d4a394ce162588a327a6e Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 31 Aug 2019 14:14:13 +0200 Subject: [PATCH] [Base] Remove MAX_PATH limit from GetUserFolder Replace SHGetFolderPath with SHGetKnownFolderPath to remove the limit --- src/xenia/base/filesystem_win.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc index 2028a2d9a..02ff006f4 100644 --- a/src/xenia/base/filesystem_win.cc +++ b/src/xenia/base/filesystem_win.cc @@ -31,12 +31,14 @@ std::wstring GetExecutableFolder() { } std::wstring GetUserFolder() { - wchar_t path[MAX_PATH]; - if (!SUCCEEDED(SHGetFolderPathW(nullptr, CSIDL_MYDOCUMENTS, nullptr, - SHGFP_TYPE_CURRENT, path))) { - return std::wstring(); + std::wstring result; + PWSTR path; + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_DEFAULT, + nullptr, &path))) { + result.assign(path); + CoTaskMemFree(path); } - return std::wstring(path); + return result; } bool PathExists(const std::wstring& path) {