Merge pull request #96526 from bruvzg/win_env
[Windows] Use the same API for all `OS_Windows::*_environment` functions.
This commit is contained in:
commit
82799d7687
1 changed files with 1 additions and 10 deletions
|
@ -1614,16 +1614,7 @@ String OS_Windows::get_executable_path() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OS_Windows::has_environment(const String &p_var) const {
|
bool OS_Windows::has_environment(const String &p_var) const {
|
||||||
#ifdef MINGW_ENABLED
|
return GetEnvironmentVariableW((LPCWSTR)(p_var.utf16().get_data()), nullptr, 0) > 0;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String OS_Windows::get_environment(const String &p_var) const {
|
String OS_Windows::get_environment(const String &p_var) const {
|
||||||
|
|
Loading…
Reference in a new issue