From d46e411b4475ffd5cc6871b5e5dc70150d930164 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 28 Apr 2020 19:25:02 +0200 Subject: 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. --- core/bind/core_bind.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index e8955c05df..e2774deb3c 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -237,6 +237,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); }; -- cgit v1.2.3