What is the current state of File/Directory functions for Android (and general)

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

So after bashing my head against the wall for hours, I’m seeing some interesting behaviour with file/dir handling, especially on Android.

I have save/load working for a single save game file as per the standard method and this works fine as I’m just reading/writing one single file.

I’m simply trying to store multiple files in user:// and list/retrieve them later. It seems I can’t open the user:// dir on Android at all, so that seems to put an end to that idea.

Also there seem to be other quirks on both Windows and Android. Some I have noted:

  1. Directory.list_ dir_ begin() always returns False whether it fails or succeeds (Android and Windows)

  2. Directory.open() returns ERR_INVALID_PARAMETER (31) if directory doesn’t exist which seems to me unintuitive (why not e.g. ERR_FILE_BAD_PATH?)

  3. If I call Directory.open() on a non-existent directory, subsequently using list_ dir_ begin()/get_next() still succeeds but it lists the files in res:// (same for Android and Windows)

Any insight would be great. Sorry if this is old news but I’m starting out in Godot and haven’t seen references to it and docs in general are scarce. Loving Godot though!

edit: also looks like Directory.remove() doesn’t delete a file on Android (works on Windows). I get error 2 (ERR_UNAVAILABLE) on a file that definitely exists (is detected by File.file_exists()

:bust_in_silhouette: Reply From: Martin Eigel

It seems the problem with Directory.remove(file) is still present in 2.1 linux and android. Haven’t checked the other issues.