diff --git a/cargo-coupler/src/main.rs b/cargo-coupler/src/main.rs index 4692d87..fcdc3dc 100644 --- a/cargo-coupler/src/main.rs +++ b/cargo-coupler/src/main.rs @@ -179,6 +179,7 @@ impl FromStr for Target { struct PackageInfo { package_name: String, + crate_name: String, name: String, format: Format, } @@ -406,6 +407,8 @@ fn bundle(cmd: &Bundle) { process::exit(1); }; + let crate_name = package_name.replace('-', "_"); + let has_cdylib = metadata.packages[index] .targets .iter() @@ -420,6 +423,7 @@ fn bundle(cmd: &Bundle) { packages_to_build.push(PackageInfo { package_name, + crate_name, name: coupler_metadata.name.as_ref().unwrap_or(&package.name).clone(), format, }); @@ -534,8 +538,7 @@ fn bundle(cmd: &Bundle) { } fn bundle_clap(package_info: &PackageInfo, out_dir: &Path, target: &Target) { - let package_name = &package_info.package_name; - let crate_name = package_name.replace('-', "_"); + let crate_name = &package_info.crate_name; let src = match target.os { Os::Linux => out_dir.join(format!("lib{crate_name}.so")), Os::MacOs => out_dir.join(format!("lib{crate_name}.dylib")), @@ -568,8 +571,7 @@ fn bundle_clap(package_info: &PackageInfo, out_dir: &Path, target: &Target) { } fn bundle_vst3(package_info: &PackageInfo, out_dir: &Path, target: &Target) { - let package_name = &package_info.package_name; - let crate_name = package_name.replace('-', "_"); + let crate_name = &package_info.crate_name; let src = match target.os { Os::Linux => out_dir.join(format!("lib{crate_name}.so")), Os::MacOs => out_dir.join(format!("lib{crate_name}.dylib")),