0 votes

I'm trying to open a path with the systems filemanager. Therefore I use OS.shell_open(path) and it works well (at least on Windows) for absolute strings like:

OS.shell_open("C:/Users/<username>/AppData/Roaming/Godot/app_userdata/...")

My problem is that I want to open up the user directory directly without knowing what the user name is. I tried something like:

OS.shell_open("%appdata%/Godot/app_userdata/...")

But it doesn't work. Is there a possiblity to get the path to the user://-directory? Is there a cross-platform way to achieve that?

asked Feb 5, 2018 in Engine by rolfpancake (1,006 points)

1 Answer

+1 vote
Best answer

OS.get_user_data_dir()

http://docs.godotengine.org/en/latest/classes/class_os.html#class-os-get-user-data-dir

String get_user_data_dir ( ) const
Returns the absolute directory path where user data is written (user://).
answered Feb 5, 2018 by volzhs (9,464 points)
selected Feb 5, 2018 by rolfpancake

I must have been blind o.0
Awesome, thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.