@@ -56,11 +56,18 @@ fn main() -> Result<()> {
5656 . find ( |arg| arg. starts_with ( "--profile=" ) )
5757 . map ( |arg| arg. split_at ( 10 ) . 1 . to_string ( ) )
5858 . unwrap_or_else ( || "release" . into ( ) ) ;
59- std:: env:: args ( )
59+ let profile = std:: env:: args ( )
6060 . skip ( 2 )
6161 . find ( |arg| arg. starts_with ( "--target=" ) )
6262 . map ( |arg| format ! ( "{}/{}" , arg. split_at( 9 ) . 1 , profile) )
63- . unwrap_or_else ( || profile)
63+ . unwrap_or_else ( || profile) ;
64+
65+ // TODO: in-depth metadata parsing
66+ if profile == "dev" {
67+ "debug" . to_string ( )
68+ } else {
69+ profile
70+ }
6471 } ;
6572 let link_deps;
6673 let mut link_exclude_list = Vec :: with_capacity ( 0 ) ;
@@ -82,17 +89,11 @@ fn main() -> Result<()> {
8289 }
8390 _ => assets = Vec :: with_capacity ( 0 ) ,
8491 }
85- match t. get ( "icon" ) {
86- Some ( Value :: String ( s) ) => {
87- icon_path = s;
88- }
89- _ => { } ,
92+ if let Some ( Value :: String ( s) ) = t. get ( "icon" ) {
93+ icon_path = s;
9094 }
91- match t. get ( "desktop_entry" ) {
92- Some ( Value :: String ( s) ) => {
93- desktop_entry_path = s;
94- }
95- _ => { } ,
95+ if let Some ( Value :: String ( s) ) = t. get ( "desktop_entry" ) {
96+ desktop_entry_path = s;
9697 }
9798 match t. get ( "auto_link" ) {
9899 Some ( Value :: Boolean ( v) ) => link_deps = v. to_owned ( ) ,
@@ -201,10 +202,10 @@ fn main() -> Result<()> {
201202 let path = & i?. path ( ) ;
202203
203204 // Skip if it matches the exclude list.
204- if let Some ( file_name) = path. file_name ( ) . and_then ( |p| p. to_str ( ) ) {
205- if link_exclude_list. iter ( ) . any ( |p| p. matches ( file_name) ) {
206- continue ;
207- }
205+ if let Some ( file_name) = path. file_name ( ) . and_then ( |p| p. to_str ( ) )
206+ && link_exclude_list. iter ( ) . any ( |p| p. matches ( file_name) )
207+ {
208+ continue ;
208209 }
209210
210211 let link = std:: fs:: read_link ( path)
@@ -279,8 +280,11 @@ fn main() -> Result<()> {
279280 )
280281 } ) ?;
281282 } else {
282- std:: fs:: copy ( desktop_entry_path, appdirpath. join ( "cargo-appimage.desktop" ) )
283- . context ( format ! ( "Cannot find {desktop_entry_path}" ) ) ?;
283+ std:: fs:: copy (
284+ desktop_entry_path,
285+ appdirpath. join ( "cargo-appimage.desktop" ) ,
286+ )
287+ . context ( format ! ( "Cannot find {desktop_entry_path}" ) ) ?;
284288 }
285289
286290 // Copy assets
0 commit comments