@@ -663,7 +663,7 @@ impl AppSettings for RustAppSettings {
663663 . expect ( "Cargo manifest must have the `package.name` field" ) ;
664664
665665 let out_dir = self
666- . out_dir ( options. target . clone ( ) , options. debug )
666+ . out_dir ( options. target . clone ( ) , get_profile ( options) )
667667 . with_context ( || "failed to get project out directory" ) ?;
668668
669669 let binary_extension: String = if self . target_triple . contains ( "windows" ) {
@@ -900,12 +900,12 @@ impl RustAppSettings {
900900 & self . cargo_package_settings
901901 }
902902
903- pub fn out_dir ( & self , target : Option < String > , debug : bool ) -> crate :: Result < PathBuf > {
903+ pub fn out_dir ( & self , target : Option < String > , profile : String ) -> crate :: Result < PathBuf > {
904904 get_target_dir (
905905 target
906906 . as_deref ( )
907907 . or_else ( || self . cargo_config . build ( ) . target ( ) ) ,
908- !debug ,
908+ profile ,
909909 )
910910 }
911911}
@@ -932,9 +932,9 @@ fn get_cargo_metadata() -> crate::Result<CargoMetadata> {
932932 Ok ( serde_json:: from_slice ( & output. stdout ) ?)
933933}
934934
935- /// This function determines the 'target' directory and suffixes it with 'release' or 'debug'
935+ /// This function determines the 'target' directory and suffixes it with the profile
936936/// to determine where the compiled binary will be located.
937- fn get_target_dir ( target : Option < & str > , is_release : bool ) -> crate :: Result < PathBuf > {
937+ fn get_target_dir ( target : Option < & str > , profile : String ) -> crate :: Result < PathBuf > {
938938 let mut path = get_cargo_metadata ( )
939939 . with_context ( || "failed to get cargo metadata" ) ?
940940 . target_directory ;
@@ -943,7 +943,7 @@ fn get_target_dir(target: Option<&str>, is_release: bool) -> crate::Result<PathB
943943 path. push ( triple) ;
944944 }
945945
946- path. push ( if is_release { "release" } else { "debug" } ) ;
946+ path. push ( profile ) ;
947947
948948 Ok ( path)
949949}
@@ -957,6 +957,15 @@ pub fn get_workspace_dir() -> crate::Result<PathBuf> {
957957 )
958958}
959959
960+ pub fn get_profile ( options : & Options ) -> String {
961+ options
962+ . args
963+ . iter ( )
964+ . position ( |a| a == "--profile" )
965+ . map ( |i| options. args [ i + 1 ] . clone ( ) )
966+ . unwrap_or_else ( || if options. debug { "debug" } else { "release" } . into ( ) )
967+ }
968+
960969#[ allow( unused_variables) ]
961970fn tauri_config_to_bundle_settings (
962971 manifest : & Manifest ,
0 commit comments