@@ -198,8 +198,16 @@ impl AppSettings {
198198 self . package_settings . clone ( )
199199 }
200200
201- pub fn get_binaries ( & self , config : & Config ) -> crate :: Result < Vec < BundleBinary > > {
201+ pub fn get_binaries ( & self , config : & Config , target : & str ) -> crate :: Result < Vec < BundleBinary > > {
202202 let mut binaries: Vec < BundleBinary > = vec ! [ ] ;
203+
204+ let binary_extension: String = if target. contains ( "windows" ) {
205+ ".exe"
206+ } else {
207+ ""
208+ }
209+ . into ( ) ;
210+
203211 if let Some ( bin) = & self . cargo_settings . bin {
204212 let default_run = self
205213 . package_settings
@@ -212,14 +220,21 @@ impl AppSettings {
212220 || binary. name . as_str ( ) == default_run
213221 {
214222 BundleBinary :: new (
215- config
216- . package
217- . binary_name ( )
218- . unwrap_or_else ( || binary. name . clone ( ) ) ,
223+ format ! (
224+ "{}{}" ,
225+ config
226+ . package
227+ . binary_name( )
228+ . unwrap_or_else( || binary. name. clone( ) ) ,
229+ & binary_extension
230+ ) ,
219231 true ,
220232 )
221233 } else {
222- BundleBinary :: new ( binary. name . clone ( ) , false )
234+ BundleBinary :: new (
235+ format ! ( "{}{}" , binary. name. clone( ) , & binary_extension) ,
236+ false ,
237+ )
223238 }
224239 . set_src_path ( binary. path . clone ( ) ) ,
225240 )
@@ -236,7 +251,10 @@ impl AppSettings {
236251 bin. name ( ) == name || path. ends_with ( bin. src_path ( ) . unwrap_or ( & "" . to_string ( ) ) )
237252 } ) ;
238253 if !bin_exists {
239- binaries. push ( BundleBinary :: new ( name. to_string_lossy ( ) . to_string ( ) , false ) )
254+ binaries. push ( BundleBinary :: new (
255+ format ! ( "{}{}" , name. to_string_lossy( ) , & binary_extension) ,
256+ false ,
257+ ) )
240258 }
241259 }
242260 }
@@ -251,10 +269,14 @@ impl AppSettings {
251269 }
252270 None => {
253271 binaries. push ( BundleBinary :: new (
254- config
255- . package
256- . binary_name ( )
257- . unwrap_or_else ( || default_run. to_string ( ) ) ,
272+ format ! (
273+ "{}{}" ,
274+ config
275+ . package
276+ . binary_name( )
277+ . unwrap_or_else( || default_run. to_string( ) ) ,
278+ & binary_extension
279+ ) ,
258280 true ,
259281 ) ) ;
260282 }
@@ -266,7 +288,11 @@ impl AppSettings {
266288 #[ cfg( target_os = "linux" ) ]
267289 self . package_settings . product_name . to_kebab_case ( ) ,
268290 #[ cfg( not( target_os = "linux" ) ) ]
269- self . package_settings . product_name . clone ( ) ,
291+ format ! (
292+ "{}{}" ,
293+ self . package_settings. product_name. clone( ) ,
294+ & binary_extension
295+ ) ,
270296 true ,
271297 ) ) ,
272298 1 => binaries. get_mut ( 0 ) . unwrap ( ) . set_main ( true ) ,
0 commit comments