From ab837c810b6f620212878ed4fefb241cabcf22e9 Mon Sep 17 00:00:00 2001 From: alikates Date: Fri, 6 Sep 2024 18:19:23 +0200 Subject: [PATCH] Fix copying vendored files when they are symbolic links --- src/cmd/vendor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd/vendor.rs b/src/cmd/vendor.rs index 18081380..add1da55 100644 --- a/src/cmd/vendor.rs +++ b/src/cmd/vendor.rs @@ -757,6 +757,10 @@ 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(), @@ -764,7 +768,7 @@ pub fn copy_recursively( 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 {