Added symlink support on removeCommonPath

This commit is contained in:
Devenor 2015-03-25 21:52:27 +01:00 committed by Jools Wills
parent 59d4ad7c1e
commit 9b78834b42

View file

@ -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())