How to get app external files path on Android?

Godot Version

4.5.1

Question

I want to load files from the path like "/storage/emulated/0/Android/data/com.example.vrmdemo/files/"so I can copy my files manually to the directory. However, I have to use the hard-coded string path because I can’t find a function that return such a path.

Both “OS.get_user_data_dir()” and “OS.get_data_dir()” returns “/data/data/com.example.vrmdemo/files”, and the “OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)” returns “/storage/emulated/0”.

On iOS, I can get it by “OS.get_environment(“HOME”)“.

Does it exist such a function to get what I need?

You can’t access files outside local app storage without requesting manage_external_storage. You can do so via the export menu, and after that by using OS.request_permissions().

If you want to avoid requesting that permission, since it’s discouraged by Google, you’ll either have to wait until the SAF PR gets merged (looks like 4.6, but you never know), or use a plugin.

1 Like

What a pity. Thanks for your reply.