mirror of
https://github.com/godotengine/godot.git
synced 2025-04-07 00:44:24 +08:00
Merge pull request #52842 from Ev1lbl0w/fix_win_open_errcode
Fix shell_open not returning errors on Windows
This commit is contained in:
commit
a412011be7
@ -557,8 +557,27 @@ String OS_Windows::get_stdin_string(bool p_block) {
|
||||
}
|
||||
|
||||
Error OS_Windows::shell_open(String p_uri) {
|
||||
ShellExecuteW(nullptr, nullptr, (LPCWSTR)(p_uri.utf16().get_data()), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
return OK;
|
||||
INT_PTR ret = (INT_PTR)ShellExecuteW(nullptr, nullptr, (LPCWSTR)(p_uri.utf16().get_data()), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
if (ret > 32) {
|
||||
return OK;
|
||||
} else {
|
||||
switch (ret) {
|
||||
case ERROR_FILE_NOT_FOUND:
|
||||
case SE_ERR_DLLNOTFOUND:
|
||||
return ERR_FILE_NOT_FOUND;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
return ERR_FILE_BAD_PATH;
|
||||
case ERROR_BAD_FORMAT:
|
||||
return ERR_FILE_CORRUPT;
|
||||
case SE_ERR_ACCESSDENIED:
|
||||
return ERR_UNAUTHORIZED;
|
||||
case 0:
|
||||
case SE_ERR_OOM:
|
||||
return ERR_OUT_OF_MEMORY;
|
||||
default:
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String OS_Windows::get_locale() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user