diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-04 18:55:46 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-04 18:55:46 +0200 |
commit | 82799d7687f8df66c4c8b59de1077d89078f69fa (patch) | |
tree | 909df7292cd1163fe6bc7778c2c6a7a30e3de4a2 /platform/windows/os_windows.cpp | |
parent | f8aa1f8c57443e207209359baa74006b60f8d4cb (diff) | |
parent | 319bfa9965daae7d9e9ba5f6553afa701aad8f46 (diff) | |
download | redot-engine-82799d7687f8df66c4c8b59de1077d89078f69fa.tar.gz |
Merge pull request #96526 from bruvzg/win_env
[Windows] Use the same API for all `OS_Windows::*_environment` functions.
Diffstat (limited to 'platform/windows/os_windows.cpp')
-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 47836788e1..bcc6a64671 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 { |