summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-01-04 15:42:29 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-01-04 15:43:06 -0300
commit6e2ed15ff14efe3063f66c182218f56e557bb468 (patch)
tree378040107d3d7722160f596be5e6756496ef345e /platform/osx
parent7555fdc0035533773a6bc1d54b9bc00b9d7d1a3e (diff)
Add support from properly exporting shared objects, needed for GDNative export
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/export/export.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 657a899367..23ca1e3fb9 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -541,7 +541,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
} else {
String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck");
- Error err = save_pack(p_preset, pack_path);
+
+ Vector<SharedObject> shared_objects;
+ Error err = save_pack(p_preset, pack_path, &shared_objects);
if (err == OK) {
zipOpenNewFileInZip(dst_pkg_zip,
@@ -567,11 +569,32 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
break;
zipWriteInFileInZip(dst_pkg_zip, buf, r);
}
+
zipCloseFileInZip(dst_pkg_zip);
memdelete(pf);
} else {
err = ERR_CANT_OPEN;
}
+
+ //add shared objects
+ for (int i = 0; i < shared_objects.size(); i++) {
+ Vector<uint8_t> file = FileAccess::get_file_as_array(shared_objects[i].path);
+ ERR_CONTINUE(file.empty());
+
+ zipOpenNewFileInZip(dst_pkg_zip,
+ (pkg_name + ".app/Contents/MacOS/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(),
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ Z_DEFLATED,
+ Z_DEFAULT_COMPRESSION);
+
+ zipWriteInFileInZip(dst_pkg_zip, file.ptr(), file.size());
+ zipCloseFileInZip(dst_pkg_zip);
+ }
}
}
}