-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The FileDialog could not get the path to the file correctly #45822
Comments
@HapeniaLans Please upload a minimal reproduction project to make this easier to troubleshoot. |
Here it is. |
This is quite confusing! This issue caused a bug in my program Bitmapflow when it tries to load images from another drive, since the drive letter is missing from I've found a workaround though: if you yield for the "file_selected" signal emitted by FileDialog, you will get the current path correctly, with drive letter and all. E.g. var dialog = FileDialog.new()
dialog.access = FileDialog.ACCESS_FILESYSTEM
add_child(dialog)
dialog.popup_centered_ratio()
var filename = yield(dialog, "file_selected")
# filename now holds the correct filename |
Current String FileDialog::get_current_dir() const {
return dir->get_text();
}
String FileDialog::get_current_file() const {
return file->get_text();
}
String FileDialog::get_current_path() const {
return dir->get_text().plus_file(file->get_text());
} It makes sense to expose methods to access those two raw UI values, but I guess users usually want the value of String file_text = file->get_text();
String f = file_text.is_absolute_path() ? file_text : dir_access->get_current_dir().plus_file(file_text);
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
emit_signal(SNAME("file_selected"), f);
hide(); I will send a PR once I figure out all of contributing rules. |
After some research, I found that |
Godot version:
3.2.3 and also 3.2.4 rc1
OS/device including version:
at least windows 10
Issue description:
When you select a file in a FileDialog in file system mode, it won't return a path with current driver.
For example:
When I open the file on the default drive, this is no problem. But this can cause confusion when I open files on other drives.
The text was updated successfully, but these errors were encountered: