godot: Directory.open error 31's when passed user:// path with /home being a symlink

Operating system or device - Godot version: Athlon FX8320 (8-core) x64 16 GB RAM linux/X11 Godot v2.1.beta (HEAD at 6d5d23fa8de8673f4a2b312c05588fd4e7195543)

Issue description (what happened, and what was expected):

extends Node

func _ready():
    var loc="user://"
    var dir=Directory.new()
    var err=dir.open(loc)
    if err==OK:
        dir.list_dir_begin()
        var name=dir.get_next()
        while name!="":
            print(name)
            name=dir.get_next()
    else:
            print("Failed to list ",loc," due to: ",err)

gives output like: Failed to list user:// due to 31 (ERR_INVALID_PARAMETER) The output should perhaps be the contents at user://

If loc is changed to something like OS.get_data_dir() it starts working and properly outputs a listing at user:// (OS.get_data_dir() yields the absolute path of user://)

This could be rather troublesome in games that want to have multiple saves and provide a custom dialog to select a save game to continue from (since it’ll get res:// on the above code rather than the saves) and wishes to peek into the saved games to show character, level, etc. like many console RPGs do.

Steps to reproduce: see above.

Link to minimal example project (optional but very welcome): Edit: I ended up making a small project to show the problem is not a project having no name: Project file link That project is out of date. Please see the above code.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 30 (26 by maintainers)

Most upvoted comments

No answer, so closing.

Please comment if you can still reproduce the issue, and ensure that an up-to-date minimal reproduction project is attached here.

I’ve got the bug so I’ll see if I can probe a bit dir_access_unix.cpp and see if I can backtrack the error 31 to what’s not as expected.

Assuming it affects OSX too as I think the bug is in drivers/unix.