1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[util] Fix GetEnvironmentVariableW usage

This commit is contained in:
Kacper Michajłow 2024-09-12 00:04:49 +02:00 committed by GitHub
parent 3e26958906
commit 26a14c5175
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,9 @@ namespace dxvk::env {
result.resize(MAX_PATH + 1);
DWORD len = ::GetEnvironmentVariableW(str::tows(name).c_str(), result.data(), MAX_PATH);
result.resize(len);
if (!len || len >= MAX_PATH)
return "";
result.resize(len + 1);
return str::fromws(result.data());
#else
@ -80,7 +82,9 @@ namespace dxvk::env {
exePath.resize(MAX_PATH + 1);
DWORD len = ::GetModuleFileNameW(NULL, exePath.data(), MAX_PATH);
exePath.resize(len);
if (!len || len == MAX_PATH)
return "";
exePath.resize(len + 1);
return str::fromws(exePath.data());
#elif defined(__linux__)