|
@@ -198,8 +198,16 @@ impl AppSettings {
|
|
|
self.package_settings.clone()
|
|
|
}
|
|
|
|
|
|
- pub fn get_binaries(&self, config: &Config) -> crate::Result<Vec<BundleBinary>> {
|
|
|
+ pub fn get_binaries(&self, config: &Config, target: &str) -> crate::Result<Vec<BundleBinary>> {
|
|
|
let mut binaries: Vec<BundleBinary> = vec![];
|
|
|
+
|
|
|
+ let binary_extension: String = if target.contains("windows") {
|
|
|
+ ".exe"
|
|
|
+ } else {
|
|
|
+ ""
|
|
|
+ }
|
|
|
+ .into();
|
|
|
+
|
|
|
if let Some(bin) = &self.cargo_settings.bin {
|
|
|
let default_run = self
|
|
|
.package_settings
|
|
@@ -212,14 +220,21 @@ impl AppSettings {
|
|
|
|| binary.name.as_str() == default_run
|
|
|
{
|
|
|
BundleBinary::new(
|
|
|
- config
|
|
|
- .package
|
|
|
- .binary_name()
|
|
|
- .unwrap_or_else(|| binary.name.clone()),
|
|
|
+ format!(
|
|
|
+ "{}{}",
|
|
|
+ config
|
|
|
+ .package
|
|
|
+ .binary_name()
|
|
|
+ .unwrap_or_else(|| binary.name.clone()),
|
|
|
+ &binary_extension
|
|
|
+ ),
|
|
|
true,
|
|
|
)
|
|
|
} else {
|
|
|
- BundleBinary::new(binary.name.clone(), false)
|
|
|
+ BundleBinary::new(
|
|
|
+ format!("{}{}", binary.name.clone(), &binary_extension),
|
|
|
+ false,
|
|
|
+ )
|
|
|
}
|
|
|
.set_src_path(binary.path.clone()),
|
|
|
)
|
|
@@ -236,7 +251,10 @@ impl AppSettings {
|
|
|
bin.name() == name || path.ends_with(bin.src_path().unwrap_or(&"".to_string()))
|
|
|
});
|
|
|
if !bin_exists {
|
|
|
- binaries.push(BundleBinary::new(name.to_string_lossy().to_string(), false))
|
|
|
+ binaries.push(BundleBinary::new(
|
|
|
+ format!("{}{}", name.to_string_lossy(), &binary_extension),
|
|
|
+ false,
|
|
|
+ ))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -251,10 +269,14 @@ impl AppSettings {
|
|
|
}
|
|
|
None => {
|
|
|
binaries.push(BundleBinary::new(
|
|
|
- config
|
|
|
- .package
|
|
|
- .binary_name()
|
|
|
- .unwrap_or_else(|| default_run.to_string()),
|
|
|
+ format!(
|
|
|
+ "{}{}",
|
|
|
+ config
|
|
|
+ .package
|
|
|
+ .binary_name()
|
|
|
+ .unwrap_or_else(|| default_run.to_string()),
|
|
|
+ &binary_extension
|
|
|
+ ),
|
|
|
true,
|
|
|
));
|
|
|
}
|
|
@@ -266,7 +288,11 @@ impl AppSettings {
|
|
|
#[cfg(target_os = "linux")]
|
|
|
self.package_settings.product_name.to_kebab_case(),
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
|
- self.package_settings.product_name.clone(),
|
|
|
+ format!(
|
|
|
+ "{}{}",
|
|
|
+ self.package_settings.product_name.clone(),
|
|
|
+ &binary_extension
|
|
|
+ ),
|
|
|
true,
|
|
|
)),
|
|
|
1 => binaries.get_mut(0).unwrap().set_main(true),
|