Merge pull request #43621 from Faless/fix/4.x_cli_export
Fix CLI export when export_path is in preset.
This commit is contained in:
commit
8ac9a97956
@ -760,15 +760,18 @@ void EditorNode::_fs_changed() {
|
|||||||
preset_name);
|
preset_name);
|
||||||
} else {
|
} else {
|
||||||
Ref<EditorExportPlatform> platform = preset->get_platform();
|
Ref<EditorExportPlatform> platform = preset->get_platform();
|
||||||
if (platform.is_null()) {
|
const String export_path = export_defer.path.empty() ? preset->get_export_path() : export_defer.path;
|
||||||
|
if (export_path.empty()) {
|
||||||
|
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 {
|
} else {
|
||||||
Error err = OK;
|
Error err = OK;
|
||||||
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
|
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
|
||||||
if (export_defer.path.ends_with(".zip")) {
|
if (export_path.ends_with(".zip")) {
|
||||||
err = platform->export_zip(preset, export_defer.debug, export_defer.path);
|
err = platform->export_zip(preset, export_defer.debug, export_path);
|
||||||
} else if (export_defer.path.ends_with(".pck")) {
|
} else if (export_path.ends_with(".pck")) {
|
||||||
err = platform->export_pack(preset, export_defer.debug, export_defer.path);
|
err = platform->export_pack(preset, export_defer.debug, export_path);
|
||||||
}
|
}
|
||||||
} else { // Normal project export.
|
} else { // Normal project export.
|
||||||
String config_error;
|
String config_error;
|
||||||
@ -777,7 +780,7 @@ void EditorNode::_fs_changed() {
|
|||||||
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;
|
err = missing_templates ? ERR_FILE_NOT_FOUND : ERR_UNCONFIGURED;
|
||||||
} else {
|
} else {
|
||||||
err = platform->export_project(preset, export_defer.debug, export_defer.path);
|
err = platform->export_project(preset, export_defer.debug, export_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (err) {
|
switch (err) {
|
||||||
@ -787,7 +790,7 @@ void EditorNode::_fs_changed() {
|
|||||||
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;
|
break;
|
||||||
case ERR_FILE_BAD_PATH:
|
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_defer.path);
|
export_error = vformat("Project export failed for preset '%s', the target path '%s' appears to be invalid.", preset_name, export_path);
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
||||||
|
@ -1890,14 +1890,6 @@ bool Main::start() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_export_preset != "") {
|
|
||||||
if (positional_arg == "") {
|
|
||||||
String err = "Command line includes export parameter option, but no destination path was given.\n";
|
|
||||||
err += "Please specify the binary's file path to export to. Aborting export.";
|
|
||||||
ERR_PRINT(err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (script == "" && game_path == "" && String(GLOBAL_DEF("application/run/main_scene", "")) != "") {
|
if (script == "" && game_path == "" && String(GLOBAL_DEF("application/run/main_scene", "")) != "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user