@@ -313,10 +313,10 @@ impl Gen {
313313 let dst = self . opts . out_dir . join ( artifact. destination ) ;
314314
315315 if src. is_file ( ) {
316- self . copy_file ( & src, & dst)
316+ self . copy_file ( & src, & dst, true )
317317 . unwrap_or_else ( |err| panic ! ( "Failed to copy file {}: {err}" , src. display( ) ) ) ;
318318 } else if src. is_dir ( ) {
319- self . copy_dir ( & src, & dst)
319+ self . copy_dir ( & src, & dst, true )
320320 . unwrap_or_else ( |err| panic ! ( "Failed to copy dir {}: {err}" , src. display( ) ) ) ;
321321 } else {
322322 panic ! (
@@ -357,15 +357,24 @@ impl Gen {
357357 }
358358 }
359359
360- fn copy_file ( & self , src : & Path , dst : & Path ) -> io:: Result < ( ) > {
360+ fn copy_file ( & self , src : & Path , dst : & Path , is_library : bool ) -> io:: Result < ( ) > {
361361 if let Some ( parent) = dst. parent ( ) {
362362 fs:: create_dir_all ( parent) ?;
363363 }
364+
365+ let dst = if is_library {
366+ dst. parent ( )
367+ . unwrap ( )
368+ . join ( "lib" . to_owned ( ) + dst. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) )
369+ } else {
370+ dst. to_path_buf ( )
371+ } ;
372+
364373 fs:: copy ( src, dst) ?;
365374 Ok ( ( ) )
366375 }
367376
368- fn copy_dir ( & self , src : & Path , dst : & Path ) -> io:: Result < ( ) > {
377+ fn copy_dir ( & self , src : & Path , dst : & Path , is_library : bool ) -> io:: Result < ( ) > {
369378 if !dst. exists ( ) {
370379 fs:: create_dir_all ( dst) ?;
371380 }
@@ -374,9 +383,9 @@ impl Gen {
374383 let path = entry. path ( ) ;
375384 let target = dst. join ( entry. file_name ( ) ) ;
376385 if path. is_dir ( ) {
377- self . copy_dir ( & path, & target) ?;
386+ self . copy_dir ( & path, & target, is_library ) ?;
378387 } else {
379- self . copy_file ( & path, & target) ?;
388+ self . copy_file ( & path, & target, is_library ) ?;
380389 }
381390 }
382391 Ok ( ( ) )
0 commit comments