godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.92k stars 3.2k forks source link

Class OS shell open globalized path unnecessary? #4201

Open golddotasksquestions opened 4 years ago

golddotasksquestions commented 4 years ago

Your Godot version: 3.2.3

Issue description: I don't get what is supposed to mean:

Use ProjectSettings.globalize_path to convert a res:// or user:// path into a system path for use with this method.

Both print the exact same path on both Windows and Android:

print("user dir: ", OS.get_user_data_dir())
print("globalized user dir: ", ProjectSettings.globalize_path(OS.get_user_data_dir()))

Same is true here:

print("system dir pictures: ", OS.get_system_dir(6))
print("globalized system dir pictures: ", ProjectSettings.globalize_path(OS.get_system_dir(6)))

URL to the documentation page: https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-shell-open

solfrak commented 3 months ago

I don't think the way the documentation tell us how to use the API is wrong and it's actually what we need to do in order to make it work.

With a simple example you can see that you need to use ProjectSettings.globalize_path in order to open a picture file

func _ready():
    OS.shell_open(ProjectSettings.globalize_path("res://icon.svg"))
    OS.shell_open("res://icon.svg")

the first line work fine for me and open the picture in my defaut app but the second one doesn't work