Merge pull request #58691 from miremrie/absolute-file-path-in-file-browser

This commit is contained in:
Rémi Verschelde 2022-03-04 12:25:15 +01:00 committed by GitHub
commit 7de48982fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -394,7 +394,8 @@ void EditorFileDialog::_action_pressed() {
return;
}
String f = dir_access->get_current_dir().plus_file(file->get_text());
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)) {
_save_to_recent();

View File

@ -262,7 +262,8 @@ void FileDialog::_action_pressed() {
return;
}
String f = dir_access->get_current_dir().plus_file(file->get_text());
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);