summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp28
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/project_manager.h4
3 files changed, 44 insertions, 15 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6a50976908..9ca46cfcc0 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -794,17 +794,27 @@ void EditorNode::_fs_changed() {
}
preset.unref();
}
+
if (preset.is_null()) {
- export_error = vformat(
- "Invalid export preset name: %s. Make sure `export_presets.cfg` is present in the current directory.",
- preset_name);
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (da->file_exists("res://export_presets.cfg")) {
+ export_error = vformat(
+ "Invalid export preset name: %s.\nThe following presets were detected in this project's `export_presets.cfg`:\n\n",
+ preset_name);
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ // Write the preset name between double quotes since it needs to be written between quotes on the command line if it contains spaces.
+ export_error += vformat(" \"%s\"\n", EditorExport::get_singleton()->get_export_preset(i)->get_name());
+ }
+ } else {
+ export_error = "This project doesn't have an `export_presets.cfg` file at its root.\nCreate an export preset from the \"Project > Export\" dialog and try again.";
+ }
} else {
Ref<EditorExportPlatform> platform = preset->get_platform();
const String export_path = export_defer.path.is_empty() ? preset->get_export_path() : export_defer.path;
if (export_path.is_empty()) {
- export_error = vformat("Export preset '%s' doesn't have a default export path, and none was specified.", preset_name);
+ export_error = vformat("Export preset \"%s\" doesn't have a default export path, and none was specified.", preset_name);
} else if (platform.is_null()) {
- export_error = vformat("Export preset '%s' doesn't have a matching platform.", preset_name);
+ export_error = vformat("Export preset \"%s\" doesn't have a matching platform.", preset_name);
} else {
Error err = OK;
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
@@ -817,7 +827,7 @@ void EditorNode::_fs_changed() {
String config_error;
bool missing_templates;
if (!platform->can_export(preset, config_error, missing_templates)) {
- ERR_PRINT(vformat("Cannot export project with preset '%s' due to configuration errors:\n%s", preset_name, config_error));
+ ERR_PRINT(vformat("Cannot export project with preset \"%s\" due to configuration errors:\n%s", preset_name, config_error));
err = missing_templates ? ERR_FILE_NOT_FOUND : ERR_UNCONFIGURED;
} else {
err = platform->export_project(preset, export_defer.debug, export_path);
@@ -827,13 +837,13 @@ void EditorNode::_fs_changed() {
case OK:
break;
case ERR_FILE_NOT_FOUND:
- export_error = vformat("Project export failed for preset '%s', the export template appears to be missing.", preset_name);
+ export_error = vformat("Project export failed for preset \"%s\". The export template appears to be missing.", preset_name);
break;
case ERR_FILE_BAD_PATH:
- export_error = vformat("Project export failed for preset '%s', the target path '%s' appears to be invalid.", preset_name, export_path);
+ export_error = vformat("Project export failed for preset \"%s\". The target path \"%s\" appears to be invalid.", preset_name, export_path);
break;
default:
- export_error = vformat("Project export failed with error code %d for preset '%s'.", (int)err, preset_name);
+ export_error = vformat("Project export failed with error code %d for preset \"%s\".", (int)err, preset_name);
break;
}
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 595110f7b3..d3def86bd1 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1031,7 +1031,7 @@ public:
int get_project_count() const;
void select_project(int p_index);
void select_first_visible_project();
- void erase_selected_projects();
+ void erase_selected_projects(bool p_delete_project_contents);
Vector<Item> get_selected_projects() const;
const Set<String> &get_selected_project_keys() const;
void ensure_project_visible(int p_index);
@@ -1686,7 +1686,7 @@ void ProjectList::toggle_select(int p_index) {
item.control->update();
}
-void ProjectList::erase_selected_projects() {
+void ProjectList::erase_selected_projects(bool p_delete_project_contents) {
if (_selected_project_keys.size() == 0) {
return;
}
@@ -1697,6 +1697,10 @@ void ProjectList::erase_selected_projects() {
EditorSettings::get_singleton()->erase("projects/" + item.project_key);
EditorSettings::get_singleton()->erase("favorite_projects/" + item.project_key);
+ if (p_delete_project_contents) {
+ OS::get_singleton()->move_to_trash(item.path);
+ }
+
memdelete(item.control);
_projects.remove(i);
--i;
@@ -2217,7 +2221,7 @@ void ProjectManager::_rename_project() {
}
void ProjectManager::_erase_project_confirm() {
- _project_list->erase_selected_projects();
+ _project_list->erase_selected_projects(delete_project_contents->is_pressed());
_update_project_buttons();
}
@@ -2235,12 +2239,13 @@ void ProjectManager::_erase_project() {
String confirm_message;
if (selected_list.size() >= 2) {
- confirm_message = vformat(TTR("Remove %d projects from the list?\nThe project folders' contents won't be modified."), selected_list.size());
+ confirm_message = vformat(TTR("Remove %d projects from the list?"), selected_list.size());
} else {
- confirm_message = TTR("Remove this project from the list?\nThe project folder's contents won't be modified.");
+ confirm_message = TTR("Remove this project from the list?");
}
- erase_ask->set_text(confirm_message);
+ erase_ask_label->set_text(confirm_message);
+ delete_project_contents->set_pressed(false);
erase_ask->popup_centered();
}
@@ -2665,6 +2670,16 @@ ProjectManager::ProjectManager() {
erase_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_erase_project_confirm));
add_child(erase_ask);
+ VBoxContainer *erase_ask_vb = memnew(VBoxContainer);
+ erase_ask->add_child(erase_ask_vb);
+
+ erase_ask_label = memnew(Label);
+ erase_ask_vb->add_child(erase_ask_label);
+
+ delete_project_contents = memnew(CheckBox);
+ delete_project_contents->set_text(TTR("Also delete project contents (no undo!)"));
+ erase_ask_vb->add_child(delete_project_contents);
+
multi_open_ask = memnew(ConfirmationDialog);
multi_open_ask->get_ok_button()->set_text(TTR("Edit"));
multi_open_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects));
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 49d672a8e5..d13315c022 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -67,7 +67,11 @@ class ProjectManager : public Control {
FileDialog *scan_dir;
ConfirmationDialog *language_restart_ask;
+
ConfirmationDialog *erase_ask;
+ Label *erase_ask_label;
+ CheckBox *delete_project_contents;
+
ConfirmationDialog *erase_missing_ask;
ConfirmationDialog *multi_open_ask;
ConfirmationDialog *multi_run_ask;