aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-07-11 21:31:38 +0800
committerchriseth <c@ethdev.com>2016-07-11 21:31:38 +0800
commite90ebcd63be68db46da3d481ed33b734a0d5b6ff (patch)
treee5c10cc79c9a90bd8937409867620b629c9bd51a /solc
parentefad1e05ac97c9460846778af566a7ec7f37d207 (diff)
downloaddexon-solidity-e90ebcd63be68db46da3d481ed33b734a0d5b6ff.tar.gz
dexon-solidity-e90ebcd63be68db46da3d481ed33b734a0d5b6ff.tar.zst
dexon-solidity-e90ebcd63be68db46da3d481ed33b734a0d5b6ff.zip
Store non-canonical version.
Diffstat (limited to 'solc')
-rw-r--r--solc/CommandLineInterface.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 17ab5ba4..09c7c8e8 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -531,17 +531,17 @@ bool CommandLineInterface::processInput()
CompilerStack::ReadFileCallback fileReader = [this](string const& _path)
{
- auto boostPath = boost::filesystem::path(_path);
- if (!boost::filesystem::exists(boostPath))
+ auto path = boost::filesystem::path(_path);
+ if (!boost::filesystem::exists(path))
return CompilerStack::ReadFileResult{false, "File not found."};
- boostPath = boost::filesystem::canonical(boostPath);
+ auto canonicalPath = boost::filesystem::canonical(path);
bool isAllowed = false;
for (auto const& allowedDir: m_allowedDirectories)
{
// If dir is a prefix of boostPath, we are fine.
if (
- std::distance(allowedDir.begin(), allowedDir.end()) <= std::distance(boostPath.begin(), boostPath.end()) &&
- std::equal(allowedDir.begin(), allowedDir.end(), boostPath.begin())
+ std::distance(allowedDir.begin(), allowedDir.end()) <= std::distance(canonicalPath.begin(), canonicalPath.end()) &&
+ std::equal(allowedDir.begin(), allowedDir.end(), canonicalPath.begin())
)
{
isAllowed = true;
@@ -550,12 +550,12 @@ bool CommandLineInterface::processInput()
}
if (!isAllowed)
return CompilerStack::ReadFileResult{false, "File outside of allowed directories."};
- else if (!boost::filesystem::is_regular_file(boostPath))
+ else if (!boost::filesystem::is_regular_file(canonicalPath))
return CompilerStack::ReadFileResult{false, "Not a valid file."};
else
{
- auto contents = dev::contentsString(boostPath.string());
- m_sourceCodes[boostPath.string()] = contents;
+ auto contents = dev::contentsString(canonicalPath.string());
+ m_sourceCodes[path.string()] = contents;
return CompilerStack::ReadFileResult{true, contents};
}
};