From 056d780b63b10fa847e8b274f4c41b600b9aa5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 28 Jul 2021 01:00:52 +0200 Subject: [PATCH] Better error message when base path does not exist --- solc/CommandLineInterface.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 91f2baf9a..32224ac6e 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -383,10 +383,19 @@ bool CommandLineInterface::readInputFiles() m_fileReader.setBasePath(m_options.input.basePath); - if (m_fileReader.basePath() != "" && !boost::filesystem::is_directory(m_fileReader.basePath())) + if (m_fileReader.basePath() != "") { - serr() << "Base path must be a directory: " << m_fileReader.basePath() << endl; - return false; + if (!boost::filesystem::exists(m_fileReader.basePath())) + { + serr() << "Base path does not exist: " << m_fileReader.basePath() << endl; + return false; + } + + if (!boost::filesystem::is_directory(m_fileReader.basePath())) + { + serr() << "Base path is not a directory: " << m_fileReader.basePath() << endl; + return false; + } } for (boost::filesystem::path const& allowedDirectory: m_options.input.allowedDirectories)