From 51f454da86504d6db2ad15613a09e56537f877fc Mon Sep 17 00:00:00 2001 From: hannahgreendesk Date: Sun, 16 Aug 2026 08:13:50 +0200 Subject: [PATCH] fix: resolve relative targets in Windows copy_symlink() Signed-off-by: hannahgreendesk --- include/ghc/filesystem.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index bc417e8..e1781d0 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -4085,7 +4085,9 @@ GHC_INLINE void copy_symlink(const path& existing_symlink, const path& new_symli ec.clear(); auto to = read_symlink(existing_symlink, ec); if (!ec) { - if (exists(to, ec) && is_directory(to, ec)) { + // Relative targets are relative to the source link parent (#211). + path lookup = to.is_absolute() ? to : (existing_symlink.parent_path() / to); + if (exists(lookup, ec) && is_directory(lookup, ec)) { create_directory_symlink(to, new_symlink, ec); } else {