+4 votes

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()

related to an answer for: Save Record?
asked Mar 26, 2016 in Engine by duke_meister (708 points)
edited Mar 29, 2016 by Bojidar Marinov

1 Answer

0 votes

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

answered Aug 20, 2016 by Martin Eigel (37 points)
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.