diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-09-03 16:02:35 +0300 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-17 08:57:43 +0200 |
commit | b1c1c402509dd1f259f59a4e1e5840bb9f82f522 (patch) | |
tree | b9a9e66ea343f062531bc8600dfea78a750bb2c6 /platform | |
parent | e09cada53f7c0b13e33474612e3f0230a53470df (diff) | |
download | redot-engine-b1c1c402509dd1f259f59a4e1e5840bb9f82f522.tar.gz |
[Windows] Use the same API for all `OS_Windows::*_environment` functions.
(cherry picked from commit 319bfa9965daae7d9e9ba5f6553afa701aad8f46)
Diffstat (limited to 'platform')
-rw-r--r-- | platform/windows/os_windows.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index e41e6ecc96..7572912cf6 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1500,16 +1500,7 @@ String OS_Windows::get_executable_path() const { } bool OS_Windows::has_environment(const String &p_var) const { -#ifdef MINGW_ENABLED - return _wgetenv((LPCWSTR)(p_var.utf16().get_data())) != nullptr; -#else - WCHAR *env; - size_t len; - _wdupenv_s(&env, &len, (LPCWSTR)(p_var.utf16().get_data())); - const bool has_env = env != nullptr; - free(env); - return has_env; -#endif + return GetEnvironmentVariableW((LPCWSTR)(p_var.utf16().get_data()), nullptr, 0) > 0; } String OS_Windows::get_environment(const String &p_var) const { |