Skip to content

Commit

Permalink
Merge pull request #16132 from Noshyaar/p
Browse files Browse the repository at this point in the history
ProjectManager: prevent installing project template in non-empty dir
  • Loading branch information
akien-mga authored Jan 28, 2018
2 parents f12e856 + 499a0b7 commit 4caadae
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class ProjectDialog : public ConfirmationDialog {
return "";
}

} else if (mode == MODE_NEW) {
} else {

// check if the specified folder is empty, even though this is not an error, it is good to check here
d->list_dir_begin();
Expand All @@ -174,13 +174,6 @@ class ProjectDialog : public ConfirmationDialog {
get_ok()->set_disabled(true);
return "";
}

} else if (d->file_exists("project.godot")) {

set_message(TTR("Please choose a folder that does not contain a 'project.godot' file."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
return "";
}

set_message("");
Expand Down Expand Up @@ -531,20 +524,24 @@ class ProjectDialog : public ConfirmationDialog {
set_title(TTR("Rename Project"));
get_ok()->set_text(TTR("Rename"));
name_container->show();
status_rect->hide();
msg->hide();
get_ok()->set_disabled(false);

ProjectSettings *current = memnew(ProjectSettings);

if (current->setup(project_path->get_text(), "")) {
set_message(TTR("Couldn't get project.godot in the project path."), MESSAGE_ERROR);
status_rect->show();
msg->show();
get_ok()->set_disabled(true);
} else if (current->has_setting("application/config/name")) {
project_name->set_text(current->get("application/config/name"));
}

project_name->call_deferred("grab_focus");

create_dir->hide();
status_rect->hide();
msg->hide();

} else {

Expand Down Expand Up @@ -632,7 +629,7 @@ class ProjectDialog : public ConfirmationDialog {
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
pphb->add_child(project_path);

// status button
// status icon
status_rect = memnew(TextureRect);
status_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
pphb->add_child(status_rect);
Expand Down

0 comments on commit 4caadae

Please sign in to comment.