Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document conversion from res:// or user:// to global system paths (ProjectSettings.globalize_path) #4409

Closed
PureTryOut opened this issue Nov 27, 2020 · 4 comments · Fixed by #4439
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository good first issue

Comments

@PureTryOut
Copy link

PureTryOut commented Nov 27, 2020

Moved by @akien-mga from engine repository, as it's not a bug but a sign of incomplete documentation.

There should be documentation added to https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html about this (both globalize_path and localize_path).

The documentation for the actual methods in ProjectSettings could also use some extra information (doesn't mention user://, don't give a clear idea of what the result could be). https://docs.godotengine.org/en/stable/classes/class_projectsettings.html#class-projectsettings-method-globalize-path


Godot version: 3.2.3 from Alpine Linux repositories

OS/device including version: Alpine Linux edge

Issue description:
I'm messing around with the C#/Mono bindings and I'm currently using a library that requires me to pass it an absolute path. However, it seems there is currently no way to convert a Godot path (for example cache:// or user://) to real paths so non-Godot scripts can work with it. I've seen no way to do it in the documentation and asking around on the Godot Matrix channel indicated it's just not possible.

I expected the string GetBaseDir() function to be able to do it, but it still just returns cache:// rather than the full resolved path.

@akien-mga
Copy link
Member

There's no cache:// virtual filesystem in Godot.

For res:// and user://, there's a method for that:
https://docs.godotengine.org/en/stable/classes/class_projectsettings.html#class-projectsettings-method-globalize-path

func _ready():
	print(ProjectSettings.globalize_path("res://"))
	print(ProjectSettings.globalize_path("user://"))
/home/akien/Projects/kobuge/MoonDragoon/
/home/akien/.local/share/godot/app_userdata/MoonDragoon/

I'll move this to godot-docs as if you couldn't find the information in the docs, then the docs should likely be improved.

@akien-mga akien-mga transferred this issue from godotengine/godot Nov 27, 2020
@akien-mga akien-mga changed the title No way to convert Godot paths (e.g. "cache://") to real paths Document conversion from res:// or user:// to global system paths (ProjectSettings.globalize_path) Nov 27, 2020
@PureTryOut
Copy link
Author

Ah I guess I was confused with some different path then. But yes, I couldn't find it in the docs (and neither could some other people), so docs could use some improvement 😅

Thanks for the pointer, that will do!

@Calinou Calinou added the area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository label Nov 27, 2020
@Calinou Calinou reopened this Nov 28, 2020
@Calinou
Copy link
Member

Calinou commented Nov 28, 2020

Reopening per godotengine/godot#43922 (comment).

@fire
Copy link
Member

fire commented Dec 7, 2020

Whoops, why does it do this.

Calinou added a commit to Calinou/godot-docs that referenced this issue Dec 9, 2020
Calinou added a commit to Calinou/godot-docs that referenced this issue Dec 9, 2020
Calinou added a commit to Calinou/godot-docs that referenced this issue Dec 9, 2020
Calinou added a commit to Calinou/godot-docs that referenced this issue Dec 9, 2020
HEAVYPOLY pushed a commit to HEAVYPOLY/godot that referenced this issue Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants