aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore/CommonIO.cpp
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-04-12 03:25:30 +0800
committerGitHub <noreply@github.com>2018-04-12 03:25:30 +0800
commit8d355df14c0acd8846162790536b8d9992617d3c (patch)
tree01868c388a2069bb0ca366a2183c94e7b1128eed /libdevcore/CommonIO.cpp
parent418e2725b50aebc169dd80f78a0ce3eefc2e296e (diff)
parentc15cb6cc7ac68e539dd3969e614be52e9a943ec7 (diff)
downloaddexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar.gz
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar.bz2
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar.lz
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar.xz
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.tar.zst
dexon-solidity-8d355df14c0acd8846162790536b8d9992617d3c.zip
Merge pull request #3830 from ethereum/fix-include-paths-errors
Fix include paths errors
Diffstat (limited to 'libdevcore/CommonIO.cpp')
-rw-r--r--libdevcore/CommonIO.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp
index 6526baf9..0063a8d4 100644
--- a/libdevcore/CommonIO.cpp
+++ b/libdevcore/CommonIO.cpp
@@ -167,3 +167,23 @@ int dev::readStandardInputChar()
DisableConsoleBuffering disableConsoleBuffering;
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;
+ }
+}