How the get the absolute path to the user://-directory?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rolfpancake

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:


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


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?

1 Like
:bust_in_silhouette: Reply From: volzhs


String get_user_data_dir ( ) const
Returns the absolute directory path where user data is written (user://).

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

rolfpancake | 2018-02-05 19:57

1 Like