Merge pull request #17970 from PJB3005/18-04-04-commandline-export-error-clarity

Explicitly print an error when --export fails.
This commit is contained in:
Rémi Verschelde 2018-04-06 08:36:16 +02:00 committed by GitHub
commit ec110076ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -470,24 +470,28 @@ void EditorNode::_fs_changed() {
} }
if (preset.is_null()) { if (preset.is_null()) {
String err = "Unknown export preset: " + export_defer.preset; String err = "Unknown export preset: " + export_defer.preset;
ERR_PRINT(err.utf8().get_data()); ERR_PRINTS(err);
} else { } else {
Ref<EditorExportPlatform> platform = preset->get_platform(); Ref<EditorExportPlatform> platform = preset->get_platform();
if (platform.is_null()) { if (platform.is_null()) {
String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
ERR_PRINT(err.utf8().get_data()); ERR_PRINTS(err);
} else { } else {
// ensures export_project does not loop infinitely, because notifications may // ensures export_project does not loop infinitely, because notifications may
// come during the export // come during the export
export_defer.preset = ""; export_defer.preset = "";
Error err;
if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
if (export_defer.path.ends_with(".zip")) { if (export_defer.path.ends_with(".zip")) {
platform->save_zip(preset, export_defer.path); err = platform->save_zip(preset, export_defer.path);
} else if (export_defer.path.ends_with(".pck")) { } else if (export_defer.path.ends_with(".pck")) {
platform->save_pack(preset, export_defer.path); err = platform->save_pack(preset, export_defer.path);
} }
} else { } else {
platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); err = platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
}
if (err != OK) {
ERR_PRINTS(vformat(TTR("Project export failed with error code %d."), (int)err));
} }
} }
} }