From 2da3f21af7fe11f63d8ac5c8ce17f36902054798 Mon Sep 17 00:00:00 2001 From: Olexiy Buyanskyy Date: Thu, 16 Nov 2023 08:01:20 +0200 Subject: [PATCH] fix: xattr on macos Sonoma 14.4.1 does not have -r option, bundle failing on Macos Sonoma 14.1.1 --- tooling/bundler/src/bundle/macos/app.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tooling/bundler/src/bundle/macos/app.rs b/tooling/bundler/src/bundle/macos/app.rs index cdb0bd89de50..04f9b06be091 100644 --- a/tooling/bundler/src/bundle/macos/app.rs +++ b/tooling/bundler/src/bundle/macos/app.rs @@ -23,7 +23,7 @@ // files into the `Contents` directory of the bundle. use super::{ - super::common::{self, CommandExt}, + super::common, icon::create_icns_file, sign::{notarize, notarize_auth, sign, NotarizeAuthError, SignTarget}, }; @@ -38,6 +38,7 @@ use std::{ path::{Path, PathBuf}, process::Command, }; +use walkdir::WalkDir; const NESTED_CODE_FOLDER: [&str; 6] = [ "MacOS", @@ -140,11 +141,16 @@ pub fn bundle_project(settings: &Settings) -> crate::Result> { } fn remove_extra_attr(app_bundle_path: &Path) -> crate::Result<()> { - Command::new("xattr") - .arg("-crs") - .arg(app_bundle_path) - .output_ok() - .context("failed to remove extra attributes from app bundle")?; + for entry in WalkDir::new(app_bundle_path).into_iter().filter_map(|e| e.ok()) { + let path = entry.path(); + let mut command = Command::new("xattr"); + command.arg("-c"); + if entry.file_type().is_symlink() { + command.arg("-s"); + } + command.arg(path); + command.output().with_context(|| format!("Failed to remove extra attributes from {path:?}"))?; + } Ok(()) }