Remove boost::filesystem::weakly_canonical workaround

This commit is contained in:
Alex Beregszaszi 2019-01-18 17:59:32 +00:00
parent 127c78ee64
commit 8c97fb1688
3 changed files with 1 additions and 25 deletions

View File

@ -128,26 +128,6 @@ int dev::readStandardInputChar()
return cin.get();
}
boost::filesystem::path dev::weaklyCanonicalFilesystemPath(boost::filesystem::path const &_path)
{
if (boost::filesystem::exists(_path))
return boost::filesystem::canonical(_path);
else
{
boost::filesystem::path head(_path);
boost::filesystem::path tail;
for (auto it = --_path.end(); !head.empty(); --it)
{
if (boost::filesystem::exists(head))
break;
tail = (*it) / tail;
head.remove_filename();
}
head = boost::filesystem::canonical(head);
return head / tail;
}
}
string dev::absolutePath(string const& _path, string const& _reference)
{
boost::filesystem::path p(_path);

View File

@ -50,10 +50,6 @@ std::string toString(_T const& _t)
return o.str();
}
/// Partial implementation of boost::filesystem::weakly_canonical (available in boost>=1.60).
/// Should be replaced by the boost implementation as soon as support for boost<1.60 can be dropped.
boost::filesystem::path weaklyCanonicalFilesystemPath(boost::filesystem::path const &_path);
/// @returns the absolute path corresponding to @a _path relative to @a _reference.
std::string absolutePath(std::string const& _path, std::string const& _reference);

View File

@ -731,7 +731,7 @@ bool CommandLineInterface::processInput()
try
{
auto path = boost::filesystem::path(_path);
auto canonicalPath = weaklyCanonicalFilesystemPath(path);
auto canonicalPath = boost::filesystem::weakly_canonical(path);
bool isAllowed = false;
for (auto const& allowedDir: m_allowedDirectories)
{