@@ -1213,6 +1213,7 @@ Error EditorExportPlatformMacOS::_code_sign_directory(const Ref<EditorExportPres
1213
1213
const String &p_ent_path, const String &p_helper_ent_path, bool p_should_error_on_non_code) {
1214
1214
static Vector<String> extensions_to_sign;
1215
1215
1216
+ bool sandbox = p_preset->get (" codesign/entitlements/app_sandbox/enabled" );
1216
1217
if (extensions_to_sign.is_empty ()) {
1217
1218
extensions_to_sign.push_back (" dylib" );
1218
1219
extensions_to_sign.push_back (" framework" );
@@ -1239,7 +1240,7 @@ Error EditorExportPlatformMacOS::_code_sign_directory(const Ref<EditorExportPres
1239
1240
if (extensions_to_sign.has (current_file.get_extension ())) {
1240
1241
String ent_path = p_ent_path;
1241
1242
bool set_bundle_id = false ;
1242
- if (FileAccess::exists (current_file_path)) {
1243
+ if (sandbox && FileAccess::exists (current_file_path)) {
1243
1244
int ftype = MachO::get_filetype (current_file_path);
1244
1245
if (ftype == 2 || ftype == 5 ) {
1245
1246
ent_path = p_helper_ent_path;
@@ -1274,7 +1275,7 @@ Error EditorExportPlatformMacOS::_copy_and_sign_files(Ref<DirAccess> &dir_access
1274
1275
const String &p_in_app_path, bool p_sign_enabled,
1275
1276
const Ref<EditorExportPreset> &p_preset, const String &p_ent_path,
1276
1277
const String &p_helper_ent_path,
1277
- bool p_should_error_on_non_code_sign) {
1278
+ bool p_should_error_on_non_code_sign, bool p_sandbox ) {
1278
1279
static Vector<String> extensions_to_sign;
1279
1280
1280
1281
if (extensions_to_sign.is_empty ()) {
@@ -1368,7 +1369,7 @@ Error EditorExportPlatformMacOS::_copy_and_sign_files(Ref<DirAccess> &dir_access
1368
1369
if (extensions_to_sign.has (p_in_app_path.get_extension ())) {
1369
1370
String ent_path = p_ent_path;
1370
1371
bool set_bundle_id = false ;
1371
- if (FileAccess::exists (p_in_app_path)) {
1372
+ if (p_sandbox && FileAccess::exists (p_in_app_path)) {
1372
1373
int ftype = MachO::get_filetype (p_in_app_path);
1373
1374
if (ftype == 2 || ftype == 5 ) {
1374
1375
ent_path = p_helper_ent_path;
@@ -1389,13 +1390,13 @@ Error EditorExportPlatformMacOS::_copy_and_sign_files(Ref<DirAccess> &dir_access
1389
1390
Error EditorExportPlatformMacOS::_export_macos_plugins_for (Ref<EditorExportPlugin> p_editor_export_plugin,
1390
1391
const String &p_app_path_name, Ref<DirAccess> &dir_access,
1391
1392
bool p_sign_enabled, const Ref<EditorExportPreset> &p_preset,
1392
- const String &p_ent_path, const String &p_helper_ent_path) {
1393
+ const String &p_ent_path, const String &p_helper_ent_path, bool p_sandbox ) {
1393
1394
Error error{ OK };
1394
1395
const Vector<String> &macos_plugins{ p_editor_export_plugin->get_macos_plugin_files () };
1395
1396
for (int i = 0 ; i < macos_plugins.size (); ++i) {
1396
1397
String src_path{ ProjectSettings::get_singleton ()->globalize_path (macos_plugins[i]) };
1397
1398
String path_in_app{ p_app_path_name + " /Contents/PlugIns/" + src_path.get_file () };
1398
- error = _copy_and_sign_files (dir_access, src_path, path_in_app, p_sign_enabled, p_preset, p_ent_path, p_helper_ent_path, false );
1399
+ error = _copy_and_sign_files (dir_access, src_path, path_in_app, p_sign_enabled, p_preset, p_ent_path, p_helper_ent_path, false , p_sandbox );
1399
1400
if (error != OK) {
1400
1401
break ;
1401
1402
}
@@ -2168,11 +2169,11 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
2168
2169
String src_path = ProjectSettings::get_singleton ()->globalize_path (shared_objects[i].path );
2169
2170
if (shared_objects[i].target .is_empty ()) {
2170
2171
String path_in_app = tmp_app_path_name + " /Contents/Frameworks/" + src_path.get_file ();
2171
- err = _copy_and_sign_files (da, src_path, path_in_app, sign_enabled, p_preset, ent_path, hlp_ent_path, true );
2172
+ err = _copy_and_sign_files (da, src_path, path_in_app, sign_enabled, p_preset, ent_path, hlp_ent_path, true , sandbox );
2172
2173
} else {
2173
2174
String path_in_app = tmp_app_path_name.path_join (shared_objects[i].target );
2174
2175
tmp_app_dir->make_dir_recursive (path_in_app);
2175
- err = _copy_and_sign_files (da, src_path, path_in_app.path_join (src_path.get_file ()), sign_enabled, p_preset, ent_path, hlp_ent_path, false );
2176
+ err = _copy_and_sign_files (da, src_path, path_in_app.path_join (src_path.get_file ()), sign_enabled, p_preset, ent_path, hlp_ent_path, false , sandbox );
2176
2177
}
2177
2178
if (err != OK) {
2178
2179
break ;
@@ -2181,7 +2182,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
2181
2182
2182
2183
Vector<Ref<EditorExportPlugin>> export_plugins{ EditorExport::get_singleton ()->get_export_plugins () };
2183
2184
for (int i = 0 ; i < export_plugins.size (); ++i) {
2184
- err = _export_macos_plugins_for (export_plugins[i], tmp_app_path_name, da, sign_enabled, p_preset, ent_path, hlp_ent_path);
2185
+ err = _export_macos_plugins_for (export_plugins[i], tmp_app_path_name, da, sign_enabled, p_preset, ent_path, hlp_ent_path, sandbox );
2185
2186
if (err != OK) {
2186
2187
break ;
2187
2188
}
0 commit comments