From 6a6e7e099283ddf91df57b423154b722b213585d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 22 Apr 2022 17:52:38 +0200 Subject: [PATCH] Use bundler.toml display name in MacOS bundles --- nih_plug_xtask/src/lib.rs | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/nih_plug_xtask/src/lib.rs b/nih_plug_xtask/src/lib.rs index 8b6d8584..2cdfe0ae 100644 --- a/nih_plug_xtask/src/lib.rs +++ b/nih_plug_xtask/src/lib.rs @@ -226,7 +226,12 @@ fn bundle_binary( .next() .expect("Malformed standalone binary path"), ); - maybe_create_macos_bundle_metadata(package, &standalone_bundle_home, compilation_target)?; + maybe_create_macos_bundle_metadata( + package, + &bundle_name, + &standalone_bundle_home, + compilation_target, + )?; eprintln!( "Created a standalone bundle at '{}'", @@ -276,7 +281,12 @@ fn bundle_plugin( .next() .expect("Malformed CLAP library path"), ); - maybe_create_macos_bundle_metadata(package, &clap_bundle_home, compilation_target)?; + maybe_create_macos_bundle_metadata( + package, + &bundle_name, + &clap_bundle_home, + compilation_target, + )?; eprintln!("Created a CLAP bundle at '{}'", clap_bundle_home.display()); } @@ -297,7 +307,12 @@ fn bundle_plugin( .next() .expect("Malformed VST2 library path"), ); - maybe_create_macos_bundle_metadata(package, &vst2_bundle_home, compilation_target)?; + maybe_create_macos_bundle_metadata( + package, + &bundle_name, + &vst2_bundle_home, + compilation_target, + )?; eprintln!("Created a VST2 bundle at '{}'", vst2_bundle_home.display()); } @@ -317,7 +332,12 @@ fn bundle_plugin( .unwrap() .parent() .unwrap(); - maybe_create_macos_bundle_metadata(package, vst3_bundle_home, compilation_target)?; + maybe_create_macos_bundle_metadata( + package, + &bundle_name, + vst3_bundle_home, + compilation_target, + )?; eprintln!("Created a VST3 bundle at '{}'", vst3_bundle_home.display()); } @@ -491,6 +511,7 @@ fn vst3_bundle_library_name(package: &str, target: CompilationTarget) -> String /// yourself first. pub fn maybe_create_macos_bundle_metadata( package: &str, + display_name: &str, bundle_home: &Path, target: CompilationTarget, ) -> Result<()> { @@ -498,8 +519,6 @@ pub fn maybe_create_macos_bundle_metadata( return Ok(()); } - // TODO: Use the display name from bundler.toml - // TODO: May want to add bundler.toml fields for the identifier, version and signature at some // point. fs::write(bundle_home.join("Contents").join("PkgInfo"), "BNDL????") @@ -518,9 +537,9 @@ pub fn maybe_create_macos_bundle_metadata( CFBundleIdentifier com.nih-plug.{package} CFBundleName - {package} + {display_name} CFBundleDisplayName - {package} + {display_name} CFBundlePackageType BNDL CFBundleSignature