src: fixed making file paths canonical that contain symlinks

This commit is contained in:
malte_langkabel
2017-08-08 15:05:36 +02:00
parent ff65a3f285
commit 4f74235ca1
+8 -1
View File
@@ -165,7 +165,14 @@ FilePath FilePath::canonical() const
if (boost::filesystem::is_symlink(canonicalPath))
{
canonicalPath = boost::filesystem::canonical(canonicalPath);
boost::filesystem::path symlink = boost::filesystem::read_symlink(canonicalPath);
if (!symlink.empty())
{
// on Windows the read_symlink function discards the drive letter (this is a boost bug). Therefore
// we need to make the path absolute again. We also have to discard the trailing \0 characters so
// that we can continue appending to the path.
canonicalPath = utility::substrBeforeFirst(boost::filesystem::absolute(symlink).string(), '\0');
}
}
}