diff options
author | shahriarlabib000 <shahriarlabib000@gmail.com> | 2024-09-08 18:51:01 +0600 |
---|---|---|
committer | shahriarlabib000 <shahriarlabib000@gmail.com> | 2024-09-10 10:10:33 +0600 |
commit | 8f66513badf286795c54b4677ec19a7e2f151f69 (patch) | |
tree | 0d81e6fca6c2ab5b79c6bbfddb4130123495ff5d /editor/project_manager/project_dialog.cpp | |
parent | 5675c76461e197d3929a1142cfb84ab1a76ac9dd (diff) | |
download | redot-engine-8f66513badf286795c54b4677ec19a7e2f151f69.tar.gz |
Fix directory empty bug on Android
Diffstat (limited to 'editor/project_manager/project_dialog.cpp')
-rw-r--r-- | editor/project_manager/project_dialog.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index 9b009c0a89..7acda16890 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -162,7 +162,7 @@ void ProjectDialog::_validate_path() { } } - if (target_path.is_empty() || target_path.is_relative_path()) { + if (target_path.is_relative_path()) { _set_message(TTR("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type); return; } @@ -352,7 +352,7 @@ void ProjectDialog::_install_path_changed() { void ProjectDialog::_browse_project_path() { String path = project_path->get_text(); - if (path.is_empty()) { + if (path.is_relative_path()) { path = EDITOR_GET("filesystem/directories/default_project_path"); } if (mode == MODE_IMPORT && install_path->is_visible_in_tree()) { @@ -382,12 +382,16 @@ void ProjectDialog::_browse_project_path() { void ProjectDialog::_browse_install_path() { ERR_FAIL_COND_MSG(mode != MODE_IMPORT, "Install path is only used for MODE_IMPORT."); + String path = install_path->get_text(); + if (path.is_relative_path() || !DirAccess::dir_exists_absolute(path)) { + path = EDITOR_GET("filesystem/directories/default_project_path"); + } if (create_dir->is_pressed()) { // Select parent directory of install path. - fdialog_install->set_current_dir(install_path->get_text().get_base_dir()); + fdialog_install->set_current_dir(path.get_base_dir()); } else { // Select install path. - fdialog_install->set_current_dir(install_path->get_text()); + fdialog_install->set_current_dir(path); } fdialog_install->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); |