File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1497,14 +1497,20 @@ impl Build {
14971497 let dst = dstdir. join ( src. file_name ( ) . unwrap ( ) ) ;
14981498 self . verbose_than ( 1 , & format ! ( "Install {:?} to {:?}" , src, dst) ) ;
14991499 t ! ( fs:: create_dir_all( dstdir) ) ;
1500+ drop ( fs:: remove_file ( & dst) ) ;
15001501 {
15011502 if !src. exists ( ) {
15021503 panic ! ( "Error: File \" {}\" not found!" , src. display( ) ) ;
15031504 }
1504- self . copy ( src, & dst) ;
1505+ let metadata = t ! ( src. symlink_metadata( ) ) ;
1506+ if let Err ( e) = fs:: copy ( & src, & dst) {
1507+ panic ! ( "failed to copy `{}` to `{}`: {}" , src. display( ) , dst. display( ) , e)
1508+ }
1509+ t ! ( fs:: set_permissions( & dst, metadata. permissions( ) ) ) ;
1510+ let atime = FileTime :: from_last_access_time ( & metadata) ;
1511+ let mtime = FileTime :: from_last_modification_time ( & metadata) ;
1512+ t ! ( filetime:: set_file_times( & dst, atime, mtime) ) ;
15051513 }
1506- // NOTE: when using hard-links, this will also update the permissions on the original file.
1507- // We never use permissions that are more restrictive than the original, so this shouldn't cause any issues.
15081514 chmod ( & dst, perms) ;
15091515 }
15101516
You can’t perform that action at this time.
0 commit comments