From 9b78834b42a9ef98229d51e5385695d96d95677a Mon Sep 17 00:00:00 2001 From: Devenor Date: Wed, 25 Mar 2015 21:52:27 +0100 Subject: [PATCH] Added symlink support on removeCommonPath --- es-core/src/Util.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/es-core/src/Util.cpp b/es-core/src/Util.cpp index 198e10a82..8c7dc0c92 100644 --- a/es-core/src/Util.cpp +++ b/es-core/src/Util.cpp @@ -110,7 +110,8 @@ fs::path removeCommonPath(const fs::path& path, const fs::path& relativeTo, bool return path; } - fs::path p = fs::canonical(path); + // if it's a symlink we don't want to apply fs::canonical on it, otherwise we'll lose the current parent_path + fs::path p = (fs::is_symlink(path) ? fs::canonical(path.parent_path()) / path.filename() : fs::canonical(path)); fs::path r = fs::canonical(relativeTo); if(p.root_path() != r.root_path())