From 71a819654e3c46aee92b831b835887ea200944f0 Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Tue, 3 Oct 2017 18:28:45 +0100 Subject: Allow trailing slash in solc -allow-paths. --- solc/CommandLineInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 271511d4..36fcc1a4 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -717,7 +717,7 @@ bool CommandLineInterface::processInput() { vector paths; for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as(), boost::is_any_of(","))) - m_allowedDirectories.push_back(boost::filesystem::path(path)); + m_allowedDirectories.push_back(boost::filesystem::path(path).remove_trailing_separator()); } if (m_args.count(g_argStandardJSON)) -- cgit From a458100175fa2b6d265ec939ae12b95ee89acb13 Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Thu, 5 Oct 2017 11:53:32 +0100 Subject: Do not use remove_trailing_separator from Boost 1.58 as 1.56 is required --- solc/CommandLineInterface.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 36fcc1a4..1686dc2e 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -716,8 +716,17 @@ bool CommandLineInterface::processInput() if (m_args.count(g_argAllowPaths)) { vector paths; - for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as(), boost::is_any_of(","))) - m_allowedDirectories.push_back(boost::filesystem::path(path).remove_trailing_separator()); + for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as(), boost::is_any_of(","))) { + auto filesystem_path = boost::filesystem::path(path); + // If the given path had a trailing slash, the Boost filesystem + // path will have it's last component set to '.'. This breaks + // path comparison in later parts of the code, so we need to strip + // it. + if (filesystem_path.filename() == ".") { + filesystem_path.remove_filename(); + } + m_allowedDirectories.push_back(filesystem_path); + } } if (m_args.count(g_argStandardJSON)) -- cgit