[Base] Remove MAX_PATH limit from GetUserFolder
Replace SHGetFolderPath with SHGetKnownFolderPath to remove the limit
This commit is contained in:
parent
6f2c39d8d1
commit
96a9397349
|
@ -31,12 +31,14 @@ std::wstring GetExecutableFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring GetUserFolder() {
|
std::wstring GetUserFolder() {
|
||||||
wchar_t path[MAX_PATH];
|
std::wstring result;
|
||||||
if (!SUCCEEDED(SHGetFolderPathW(nullptr, CSIDL_MYDOCUMENTS, nullptr,
|
PWSTR path;
|
||||||
SHGFP_TYPE_CURRENT, path))) {
|
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_DEFAULT,
|
||||||
return std::wstring();
|
nullptr, &path))) {
|
||||||
|
result.assign(path);
|
||||||
|
CoTaskMemFree(path);
|
||||||
}
|
}
|
||||||
return std::wstring(path);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathExists(const std::wstring& path) {
|
bool PathExists(const std::wstring& path) {
|
||||||
|
|
Loading…
Reference in New Issue