@@ -1099,7 +1099,13 @@ fn copy_dir_contents_recursive(
10991099 }
11001100 #[ cfg( not( unix) ) ]
11011101 {
1102- fs:: copy ( & from_path, & to_path) ?;
1102+ if from_path. is_symlink ( ) {
1103+ // Copy a symlink file (no-follow).
1104+ rename_symlink_fallback ( & from_path, & to_path) ?;
1105+ } else {
1106+ // Copy a regular file.
1107+ fs:: copy ( & from_path, & to_path) ?;
1108+ }
11031109 }
11041110
11051111 // Print verbose message for file
@@ -1142,14 +1148,19 @@ fn copy_file_with_hardlinks_helper(
11421148 return Ok ( ( ) ) ;
11431149 }
11441150
1145- // Regular file copy
1146- #[ cfg( all( unix, not( any( target_os = "macos" , target_os = "redox" ) ) ) ) ]
1147- {
1148- fs:: copy ( from, to) . and_then ( |_| fsxattr:: copy_xattrs ( & from, & to) ) ?;
1149- }
1150- #[ cfg( any( target_os = "macos" , target_os = "redox" ) ) ]
1151- {
1152- fs:: copy ( from, to) ?;
1151+ if from. is_symlink ( ) {
1152+ // Copy a symlink file (no-follow).
1153+ rename_symlink_fallback ( from, to) ?;
1154+ } else {
1155+ // Copy a regular file.
1156+ #[ cfg( all( unix, not( any( target_os = "macos" , target_os = "redox" ) ) ) ) ]
1157+ {
1158+ fs:: copy ( from, to) . and_then ( |_| fsxattr:: copy_xattrs ( & from, & to) ) ?;
1159+ }
1160+ #[ cfg( any( target_os = "macos" , target_os = "redox" ) ) ]
1161+ {
1162+ fs:: copy ( from, to) ?;
1163+ }
11531164 }
11541165
11551166 Ok ( ( ) )
0 commit comments