Where does "user://" point to in different OS ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By leg0
:warning: Old Version Published before Godot 3 was released.

I was using res:// (project’s folder) to save my data but discovered that it doesn’t work for android

http://docs.godotengine.org/en/stable/tutorials/step_by_step/filesystem.html?highlight=user

instead I needed to use user:// but I have no idea where it saves my data on my windows.

( same question for mac ? )

Doesn’t user:// works on iOS ?

Thanks !

:bust_in_silhouette: Reply From: Zylann

On Windows it is saved under C:\Users\yourname\AppData\Roaming\Godot\app_userdata\yourgame

On Linux I think it’s somewhere in the home folder.

I don’t know about other OSes, sorry. Maybe someone else do?

On linux is a similar location, at ~/.godot/app_userdata/yourgame

Android not sure, somewhere on a Data directory, user data partition may depend on Android version.

eons | 2017-02-20 21:11

On Mac OSX the location is the same as on Linux: ~/.godot/app_userdata/yourgame

lukas | 2017-12-02 11:29

With Godot 3 it is ~/.local/share/godot/app_userdata on Linux.

timoschwarzer | 2018-05-02 19:57

macos Catalina /Users//Library/Application Support/Godot

flurick | 2020-04-03 13:48

:bust_in_silhouette: Reply From: Daniel Mircea

Disclaimer, I never owned an iphone and I’m a beginner in godot, but I’ll attempt to untangle this.

The docs say that user:// is just an alias for OS.get_data_dir.

For example, this is how it handles the windows platform: https://github.com/godotengine/godot/blob/master/platform/windows/os_windows.cpp#L2355

However, it’s quite different for ios:
https://github.com/godotengine/godot/blob/master/platform/iphone/os_iphone.cpp#L479

String OSIPhone::get_data_dir() const {
	return data_dir;
};

At a glance, it looks like it expects a call fromset_data_dir (defined earlier in that file).

That method is not exposed to the gdscript api, it’s just used internally, as evidenced here https://github.com/godotengine/godot/blob/0c80bc2579e6d3cc904f71dacde760f1081a9cb1/platform/iphone/app_delegate.mm#L123

OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String]));

Therefore I think it’s safe to conclude that user:// is in the phone’s documents folder.