From 6f2c39d8d140bb71100e6fce883f624a24ce5670 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 25 Aug 2019 23:37:11 +0200 Subject: [PATCH] [Base] Remove MAX_PATH limit from to_absolute_path Let _wfullpath allocate memory by itself to remove the limit --- src/xenia/base/string.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/xenia/base/string.cc b/src/xenia/base/string.cc index 804127c6d..4610c661e 100644 --- a/src/xenia/base/string.cc +++ b/src/xenia/base/string.cc @@ -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);