mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Fix CLI export when export_path is in preset.
Export presets contains the export_path option, to specify the default
export location, but the CLI export option disregarded that, and always
required and export path to be specified.
After this commit, if the export path is not specified in the command,
the one in the preset will be used, erroring only if it's not present or
invalid.
(cherry picked from commit 032a1c5dc3)
This commit is contained in:
parent
755ee76871
commit
f32c878ef7
2 changed files with 10 additions and 15 deletions
|
|
@ -713,15 +713,18 @@ void EditorNode::_fs_changed() {
|
|||
preset_name);
|
||||
} else {
|
||||
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);
|
||||
} else {
|
||||
Error err = OK;
|
||||
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
|
||||
if (export_defer.path.ends_with(".zip")) {
|
||||
err = platform->export_zip(preset, export_defer.debug, export_defer.path);
|
||||
} else if (export_defer.path.ends_with(".pck")) {
|
||||
err = platform->export_pack(preset, export_defer.debug, export_defer.path);
|
||||
if (export_path.ends_with(".zip")) {
|
||||
err = platform->export_zip(preset, export_defer.debug, export_path);
|
||||
} else if (export_path.ends_with(".pck")) {
|
||||
err = platform->export_pack(preset, export_defer.debug, export_path);
|
||||
}
|
||||
} else { // Normal project export.
|
||||
String config_error;
|
||||
|
|
@ -730,7 +733,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 = missing_templates ? ERR_FILE_NOT_FOUND : ERR_UNCONFIGURED;
|
||||
} else {
|
||||
err = platform->export_project(preset, export_defer.debug, export_defer.path);
|
||||
err = platform->export_project(preset, export_defer.debug, export_path);
|
||||
}
|
||||
}
|
||||
switch (err) {
|
||||
|
|
@ -740,7 +743,7 @@ void EditorNode::_fs_changed() {
|
|||
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_defer.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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue