[Base] Remove MAX_PATH limit from to_absolute_path

Let _wfullpath allocate memory by itself to remove the limit
This commit is contained in:
Silent 2019-08-25 23:37:11 +02:00 committed by Justin Moore
parent 74c95c64d2
commit 6f2c39d8d1
1 changed files with 7 additions and 3 deletions

View File

@ -155,9 +155,13 @@ std::string::size_type find_first_of_case(const std::string& target,
std::wstring to_absolute_path(const std::wstring& path) {
#if XE_PLATFORM_WIN32
wchar_t buffer[kMaxPath];
_wfullpath(buffer, path.c_str(), sizeof(buffer) / sizeof(wchar_t));
return buffer;
std::wstring result;
wchar_t* buffer = _wfullpath(nullptr, path.c_str(), 0);
if (buffer != nullptr) {
result.assign(buffer);
free(buffer);
}
return result;
#else
char buffer[kMaxPath];
realpath(xe::to_string(path).c_str(), buffer);