mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests: Do not remove filename from boost filesystem path for corner
cases. Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
co-authored by
Kamil Śliwak
parent
6fd5ea01d1
commit
1ddfc7463a
@@ -137,7 +137,11 @@ string solidity::util::absolutePath(string const& _path, string const& _referenc
|
||||
if (p.begin() == p.end() || (*p.begin() != "." && *p.begin() != ".."))
|
||||
return _path;
|
||||
boost::filesystem::path result(_reference);
|
||||
result.remove_filename();
|
||||
|
||||
// If filename is "/", then remove_filename() throws.
|
||||
// See: https://github.com/boostorg/filesystem/issues/176
|
||||
if (result.filename() != boost::filesystem::path("/"))
|
||||
result.remove_filename();
|
||||
for (boost::filesystem::path::iterator it = p.begin(); it != p.end(); ++it)
|
||||
if (*it == "..")
|
||||
result = result.parent_path();
|
||||
|
||||
Reference in New Issue
Block a user