Closed tonebacas closed 1 year ago
Resetting the root_subfolder
value when changing the access
is something that also happens in Godot's FileDialog
:
This is done in order to offer a better UX when using the editor: changing the access
would reset the root_subfolder
since it no longer makes sense.
Do you think this issue may be solved by adding a comment to the documentation? A comment that warns users that changing the access
would also reset the value of the root_subfolder
.
Sample code:
Error at runtime (line 11 is
f.root_subfolder = "res://"
)If I swap the two lines, the sample code runs without errors as expected, opening a file dialog at the specified path.
I've looked at the code in the following line and noticed you're calling
set_root_subfolder("")
at the end of theNativeFileDialog::set_access
function. I suppose this is done as a way to handle Godot's paths starting withres://
oruser://
.https://github.com/98teg/NativeDialogs/blob/a6acb2d4449f4017b7d9907122c0970782f4dc4a/src/native_file_dialog.cpp#L194
As a workaround, setting
root_subfolder
after settingaccess
solves the problem.