summaryrefslogtreecommitdiff
path: root/platform/osx/export/export.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-07 13:29:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-01-07 14:25:56 +0100
commit5011afcb6ad6a7f7eb37a2cb74f28985e70cbc20 (patch)
tree337be6abf4964783cc3a47bdaf6345c4ed9e806e /platform/osx/export/export.cpp
parent96fdb48edd49966485cc344a01eaaa74a2999d42 (diff)
Export: Improve usability of command line interface
I'm barely scratching the surface of the changes needed to make the --export command line interface easy to use, but this should already improve things somewhat. - Streamline `can_export()` templates check in all platforms, checking first for the presence of official templates, then of any defined custom template, and reporting on the absence of any. Shouldn't change the actual return value much which is still true if either release or debug is usable - we might want to change that eventually and better validate against the requested target. - Fix discrepancy between platforms using `custom_package/debug` and `custom_template/debug` (resp. `release`). All now use `custom_template`, which will break compatibility for `export_presets.cfg` with earlier projects (but is easy to fix). - Use `can_export()` when attempting a command line export and report the same errors that would be shown in the editor. - Improve error reporting after a failed export attempt, handling missing template and invalid path more gracefully. - Cleanup of unused stuff in EditorNode around the export workflow. - Improve --export documentation in --help a bit. Fixes #16949 (at least many of the misunderstandings listed there). Fixes #18470.
Diffstat (limited to 'platform/osx/export/export.cpp')
-rw-r--r--platform/osx/export/export.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index dd98a98996..ce7b47c414 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -118,8 +118,8 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset>
void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) {
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine"));
@@ -459,9 +459,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
EditorProgress ep("export", "Exporting for OSX", 3, true);
if (p_debug)
- src_pkg_name = p_preset->get("custom_package/debug");
+ src_pkg_name = p_preset->get("custom_template/debug");
else
- src_pkg_name = p_preset->get("custom_package/release");
+ src_pkg_name = p_preset->get("custom_template/release");
if (src_pkg_name == "") {
String err;
@@ -796,33 +796,32 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
- bool valid = false;
String err;
+ bool valid = false;
- if (exists_export_template("osx.zip", &err)) {
- valid = true;
- }
+ // Look for export templates (first official, and if defined custom templates).
- if (p_preset->get("custom_package/debug") != "") {
- if (FileAccess::exists(p_preset->get("custom_package/debug"))) {
- valid = true;
- } else {
+ bool dvalid = exists_export_template("osx.zip", &err);
+ bool rvalid = dvalid; // Both in the same ZIP.
+
+ if (p_preset->get("custom_template/debug") != "") {
+ dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
+ if (!dvalid) {
err += TTR("Custom debug template not found.") + "\n";
}
}
-
- if (p_preset->get("custom_package/release") != "") {
- if (FileAccess::exists(p_preset->get("custom_package/release"))) {
- valid = true;
- } else {
+ if (p_preset->get("custom_template/release") != "") {
+ rvalid = FileAccess::exists(p_preset->get("custom_template/release"));
+ if (!rvalid) {
err += TTR("Custom release template not found.") + "\n";
}
}
+ valid = dvalid || rvalid;
+ r_missing_templates = !valid;
+
if (!err.empty())
r_error = err;
-
- r_missing_templates = !valid;
return valid;
}