From 319bfa9965daae7d9e9ba5f6553afa701aad8f46 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 3 Sep 2024 16:02:35 +0300 Subject: [PATCH] [Windows] Use the same API for all `OS_Windows::*_environment` functions. --- platform/windows/os_windows.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 47836788e1a..bcc6a64671c 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1614,16 +1614,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 {