diff options
author | chriseth <c@ethdev.com> | 2016-01-12 08:04:39 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-01-12 08:05:05 +0800 |
commit | 287f0a2ddfe715a3c9b6992c158852047bcd1e57 (patch) | |
tree | 6382ce0ad9e7f57c1444f0f7664d3090d0eed342 /solc | |
parent | aa645d11927dce715ed3507e4b2ae89cf984a488 (diff) | |
download | dexon-solidity-287f0a2ddfe715a3c9b6992c158852047bcd1e57.tar.gz dexon-solidity-287f0a2ddfe715a3c9b6992c158852047bcd1e57.tar.zst dexon-solidity-287f0a2ddfe715a3c9b6992c158852047bcd1e57.zip |
Autoload files in solc.
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index fe760fdf..4c9de3c8 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -497,7 +497,18 @@ bool CommandLineInterface::processInput() return link(); } - m_compiler.reset(new CompilerStack(m_args.count(g_argAddStandard) > 0)); + function<pair<string,string>(string const&)> fileReader = [this](string const& _path) + { + auto path = boost::filesystem::path(_path); + if (!boost::filesystem::exists(path)) + return make_pair(string(), string("File not found.")); + else if (!boost::filesystem::is_regular_file(path)) + return make_pair(string(), string("Not a valid file.")); + else + return make_pair(m_sourceCodes[_path] = dev::contentsString(_path), string()); + }; + + m_compiler.reset(new CompilerStack(m_args.count(g_argAddStandard) > 0, fileReader)); try { for (auto const& sourceCode: m_sourceCodes) |