Fix detectin of existing file being a dir in new script creation, closes #9958
This commit is contained in:
parent
8f30c52a37
commit
5f8df8bc11
1 changed files with 8 additions and 1 deletions
|
@ -352,9 +352,16 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
|||
/* Does file already exist */
|
||||
|
||||
DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
if (f->file_exists(p) && !(f->current_is_dir())) {
|
||||
if (f->dir_exists(p)) {
|
||||
is_new_script_created = false;
|
||||
is_path_valid = false;
|
||||
_msg_path_valid(false, TTR("Directory of the same name exists"));
|
||||
} else if (f->file_exists(p)) {
|
||||
is_new_script_created = false;
|
||||
is_path_valid = true;
|
||||
_msg_path_valid(true, TTR("File exists, will be reused"));
|
||||
} else {
|
||||
path_error_label->set_text("");
|
||||
}
|
||||
memdelete(f);
|
||||
_update_dialog();
|
||||
|
|
Loading…
Reference in a new issue