Skip to content

Commit 8f66513

Browse files
Fix directory empty bug on Android
1 parent 5675c76 commit 8f66513

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

editor/project_manager/project_dialog.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void ProjectDialog::_validate_path() {
162162
}
163163
}
164164

165-
if (target_path.is_empty() || target_path.is_relative_path()) {
165+
if (target_path.is_relative_path()) {
166166
_set_message(TTR("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type);
167167
return;
168168
}
@@ -352,7 +352,7 @@ void ProjectDialog::_install_path_changed() {
352352

353353
void ProjectDialog::_browse_project_path() {
354354
String path = project_path->get_text();
355-
if (path.is_empty()) {
355+
if (path.is_relative_path()) {
356356
path = EDITOR_GET("filesystem/directories/default_project_path");
357357
}
358358
if (mode == MODE_IMPORT && install_path->is_visible_in_tree()) {
@@ -382,12 +382,16 @@ void ProjectDialog::_browse_project_path() {
382382
void ProjectDialog::_browse_install_path() {
383383
ERR_FAIL_COND_MSG(mode != MODE_IMPORT, "Install path is only used for MODE_IMPORT.");
384384

385+
String path = install_path->get_text();
386+
if (path.is_relative_path() || !DirAccess::dir_exists_absolute(path)) {
387+
path = EDITOR_GET("filesystem/directories/default_project_path");
388+
}
385389
if (create_dir->is_pressed()) {
386390
// Select parent directory of install path.
387-
fdialog_install->set_current_dir(install_path->get_text().get_base_dir());
391+
fdialog_install->set_current_dir(path.get_base_dir());
388392
} else {
389393
// Select install path.
390-
fdialog_install->set_current_dir(install_path->get_text());
394+
fdialog_install->set_current_dir(path);
391395
}
392396

393397
fdialog_install->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);

0 commit comments

Comments
 (0)