@@ -717,50 +717,56 @@ impl StrictPath {
717
717
718
718
if let Err ( e) = target_file. create_parent_dir ( ) {
719
719
log:: error!(
720
- "[{context}] unable to create parent directories: {} -> {} | {e}" ,
721
- self . raw ( ) ,
722
- target_file. raw ( )
720
+ "[{context}] unable to create parent directories: {:? } -> {:? } | {e}" ,
721
+ & self ,
722
+ & target_file
723
723
) ;
724
724
return Err ( e) ;
725
725
}
726
726
727
+ if let Err ( e) = self . unset_readonly ( context) {
728
+ log:: warn!( "[{context}] failed to unset read-only on source: {:?} | {e}" , & self ) ;
729
+ return Err ( std:: io:: Error :: new (
730
+ std:: io:: ErrorKind :: Other ,
731
+ "Failed to unset read-only" ,
732
+ ) ) ;
733
+ }
727
734
if let Err ( e) = target_file. unset_readonly ( context) {
728
735
log:: warn!(
729
- "[{context}] failed to unset read-only on target: {} | {e}" ,
730
- target_file. raw ( )
736
+ "[{context}] failed to unset read-only on target: {:? } | {e}" ,
737
+ & target_file
731
738
) ;
732
739
return Err ( std:: io:: Error :: new (
733
740
std:: io:: ErrorKind :: Other ,
734
741
"Failed to unset read-only" ,
735
742
) ) ;
736
- } else if let Err ( e) = self . copy_to ( target_file) {
737
- log:: error!(
738
- "[{context}] unable to copy: {} -> {} | {e}" ,
739
- self . raw( ) ,
740
- target_file. raw( )
741
- ) ;
743
+ }
744
+
745
+ if let Err ( e) = self . copy_to ( target_file) {
746
+ log:: error!( "[{context}] unable to copy: {:?} -> {:?} | {e}" , & self , & target_file) ;
742
747
return Err ( e) ;
743
- } else {
744
- let mtime = match self . get_mtime ( ) {
745
- Ok ( x) => x,
746
- Err ( e) => {
747
- log:: error!(
748
- "[{context}] unable to get modification time: {} -> {} | {e}" ,
749
- self . raw( ) ,
750
- target_file. raw( ) ,
751
- ) ;
752
- return Err ( e) ;
753
- }
754
- } ;
755
- if let Err ( e) = target_file. set_mtime ( mtime) {
748
+ }
749
+
750
+ let mtime = match self . get_mtime ( ) {
751
+ Ok ( x) => x,
752
+ Err ( e) => {
756
753
log:: error!(
757
- "[{context}] unable to set modification time: {} -> {} to {mtime:# ?} | {e}" ,
758
- self . raw ( ) ,
759
- target_file. raw ( ) ,
754
+ "[{context}] unable to get modification time: {:? } -> {: ?} | {e}" ,
755
+ & self ,
756
+ & target_file,
760
757
) ;
761
758
return Err ( e) ;
762
759
}
760
+ } ;
761
+ if let Err ( e) = target_file. set_mtime ( mtime) {
762
+ log:: error!(
763
+ "[{context}] unable to set modification time: {:?} -> {:?} to {mtime:#?} | {e}" ,
764
+ & self ,
765
+ & target_file,
766
+ ) ;
767
+ return Err ( e) ;
763
768
}
769
+
764
770
Ok ( ( ) )
765
771
}
766
772
0 commit comments