Skip to content

Commit

Permalink
Fix copying vendored files when they are symbolic links
Browse files Browse the repository at this point in the history
  • Loading branch information
alikates committed Sep 7, 2024
1 parent 7fa835c commit ab837c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cmd/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,14 +757,18 @@ pub fn copy_recursively(
}

let filetype = entry.file_type()?;
let canonical_path_filetype =
std::fs::metadata(std::fs::canonicalize(entry.path()).unwrap())
.unwrap()
.file_type();
if filetype.is_dir() {
copy_recursively(
entry.path(),
destination.as_ref().join(entry.file_name()),
includes,
ignore,
)?;
} else if filetype.is_symlink() {
} else if filetype.is_symlink() && canonical_path_filetype.is_dir() {
let orig = std::fs::read_link(entry.path());
symlink_dir(orig.unwrap(), destination.as_ref().join(entry.file_name()))?;
} else {
Expand Down

0 comments on commit ab837c8

Please sign in to comment.