The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+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?
in Engine by (728 points)
edited by

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.

by (40 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.