You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Warn when trying to open res:// or user:// with OS.shell_open()
`OS.shell_open()` will pass on the path directly to the OS' shell
handler (which can handle file paths or URLs). It can't handle
Godot-specific paths, so these need to be converted with
`ProjectSettings.globalize_path()` first.
(cherry picked from commit d46e411b44)
This commit is contained in:
committed by
Rémi Verschelde
parent
9b636a2ccd
commit
6fb6107e6a
@@ -489,6 +489,11 @@ String _OS::get_executable_path() const {
|
||||
|
||||
Error _OS::shell_open(String p_uri) {
|
||||
|
||||
if (p_uri.begins_with("res://")) {
|
||||
WARN_PRINT("Attempting to open an URL with the \"res://\" protocol. Use `ProjectSettings.globalize_path()` to convert a Godot-specific path to a system path before opening it with `OS.shell_open()`.");
|
||||
} else if (p_uri.begins_with("user://")) {
|
||||
WARN_PRINT("Attempting to open an URL with the \"user://\" protocol. Use `ProjectSettings.globalize_path()` to convert a Godot-specific path to a system path before opening it with `OS.shell_open()`.");
|
||||
}
|
||||
return OS::get_singleton()->shell_open(p_uri);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user