Merge pull request #11856 from nix-windows/fix-windows-env-var-arg-order

[Backport 2.25] Fix argument order in the Windows implementation of `getEnvOs`
This commit is contained in:
Eelco Dolstra
2024-11-12 11:04:59 +01:00
committed by GitHub

View File

@@ -13,7 +13,7 @@ std::optional<OsString> getEnvOs(const OsString & key)
}
// Allocate a buffer to hold the environment variable value
std::wstring value{L'\0', bufferSize};
std::wstring value{bufferSize, L'\0'};
// Retrieve the environment variable value
DWORD resultSize = GetEnvironmentVariableW(key.c_str(), &value[0], bufferSize);