Skip to content

Commit

Permalink
Fix copying vendored files when they are symbolic links (#183)
Browse files Browse the repository at this point in the history
Co-authored-by: alikates <[email protected]>
  • Loading branch information
alikates and alikates authored Oct 19, 2024
1 parent 306a7a0 commit 1987d87
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 1987d87

Please sign in to comment.