Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Fix export plugins after embedded PCK loading changes. #60751

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions editor/editor_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,11 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,

Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);

Error err = prepare_template(p_preset, p_debug, p_path, p_flags);
if (err == OK) {
err = modify_template(p_preset, p_debug, p_path, p_flags);
}
if (err == OK) {
err = export_project_data(p_preset, p_debug, p_path, p_flags);
}
Expand Down
5 changes: 3 additions & 2 deletions editor/editor_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ class EditorExportPlatformPC : public EditorExportPlatform {
virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path);
virtual String get_template_file_name(const String &p_target, const String &p_arch) const = 0;

Error prepare_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
Error export_project_data(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
virtual Error prepare_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
virtual Error modify_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { return OK; };
virtual Error export_project_data(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);

void set_extension(const String &p_extension, const String &p_feature_key = "default");
void set_name(const String &p_name);
Expand Down
17 changes: 10 additions & 7 deletions platform/windows/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ Error EditorExportPlatformWindows::_export_debug_script(const Ref<EditorExportPr
return OK;
}

Error EditorExportPlatformWindows::modify_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
if (p_preset->get("application/modify_resources")) {
return _rcedit_add_data(p_preset, p_path);
} else {
return OK;
}
}

Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
String pck_path = p_path;
if (p_preset->get("binary_format/embed_pck")) {
pck_path = p_path.get_basename() + ".tmp";
}
Error err = EditorExportPlatformPC::prepare_template(p_preset, p_debug, pck_path, p_flags);
if (p_preset->get("application/modify_resources") && err == OK) {
err = _rcedit_add_data(p_preset, pck_path);
}
if (err == OK) {
err = EditorExportPlatformPC::export_project_data(p_preset, p_debug, pck_path, p_flags);
}
Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, pck_path, p_flags);
if (p_preset->get("codesign/enable") && err == OK) {
err = _code_sign(p_preset, pck_path);
}

if (p_preset->get("binary_format/embed_pck") && err == OK) {
Ref<DirAccess> tmp_dir = DirAccess::create_for_path(p_path.get_base_dir());
err = tmp_dir->rename(pck_path, p_path);
Expand Down
1 change: 1 addition & 0 deletions platform/windows/export/export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class EditorExportPlatformWindows : public EditorExportPlatformPC {

public:
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override;
virtual Error modify_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) override;
virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) override;
virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override;
virtual void get_export_options(List<ExportOption> *r_options) override;
Expand Down