diff options
Diffstat (limited to 'platform/macos/export/export_plugin.cpp')
-rw-r--r-- | platform/macos/export/export_plugin.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 802c8d42c3..a3ba31a5d9 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -30,11 +30,11 @@ #include "export_plugin.h" -#include "../logo_svg.gen.h" -#include "../run_icon_svg.gen.h" #include "codesign.h" #include "lipo.h" +#include "logo_svg.gen.h" #include "macho.h" +#include "run_icon_svg.gen.h" #include "core/io/image_loader.h" #include "core/string/translation.h" @@ -425,6 +425,7 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_pictures", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_music", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_movies", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_user_selected", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::ARRAY, "codesign/entitlements/app_sandbox/helper_executables", PROPERTY_HINT_ARRAY_TYPE, itos(Variant::STRING) + "/" + itos(PROPERTY_HINT_GLOBAL_FILE) + ":"), Array())); r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray())); @@ -1922,6 +1923,14 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p ent_f->store_line("<key>com.apple.security.files.movies.read-write</key>"); ent_f->store_line("<true/>"); } + if ((int)p_preset->get("codesign/entitlements/app_sandbox/files_user_selected") == 1) { + ent_f->store_line("<key>com.apple.security.files.user-selected.read-only</key>"); + ent_f->store_line("<true/>"); + } + if ((int)p_preset->get("codesign/entitlements/app_sandbox/files_user_selected") == 2) { + ent_f->store_line("<key>com.apple.security.files.user-selected.read-write</key>"); + ent_f->store_line("<true/>"); + } } ent_f->store_line("</dict>"); @@ -2081,10 +2090,8 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p return err; } -bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { +bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const { String err; - bool valid = false; - // Look for export templates (custom templates). bool dvalid = false; bool rvalid = false; @@ -2102,8 +2109,17 @@ bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorE } } - String architecture = p_preset->get("binary_format/architecture"); + // Look for export templates (official templates, check only is custom templates are not set). + if (!dvalid || !rvalid) { + dvalid = exists_export_template("macos.zip", &err); + rvalid = dvalid; // Both in the same ZIP. + } + bool valid = dvalid || rvalid; + r_missing_templates = !valid; + + // Check the texture formats, which vary depending on the target architecture. + String architecture = p_preset->get("binary_format/architecture"); if (architecture == "universal" || architecture == "x86_64") { const String bc_error = test_bc(); if (!bc_error.is_empty()) { @@ -2120,19 +2136,9 @@ bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorE ERR_PRINT("Invalid architecture"); } - // Look for export templates (official templates, check only is custom templates are not set). - if (!dvalid || !rvalid) { - dvalid = exists_export_template("macos.zip", &err); - rvalid = dvalid; // Both in the same ZIP. - } - - valid = dvalid || rvalid; - r_missing_templates = !valid; - if (!err.is_empty()) { r_error = err; } - return valid; } @@ -2445,11 +2451,10 @@ EditorExportPlatformMacOS::EditorExportPlatformMacOS() { Ref<Image> img = memnew(Image); const bool upsample = !Math::is_equal_approx(Math::round(EDSCALE), EDSCALE); - ImageLoaderSVG img_loader; - img_loader.create_image_from_string(img, _macos_logo_svg, EDSCALE, upsample, false); + ImageLoaderSVG::create_image_from_string(img, _macos_logo_svg, EDSCALE, upsample, false); logo = ImageTexture::create_from_image(img); - img_loader.create_image_from_string(img, _macos_run_icon_svg, EDSCALE, upsample, false); + ImageLoaderSVG::create_image_from_string(img, _macos_run_icon_svg, EDSCALE, upsample, false); run_icon = ImageTexture::create_from_image(img); #endif |