diff options
author | chriseth <chris@ethereum.org> | 2017-10-19 19:39:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-19 19:39:28 +0800 |
commit | b96602122c2380b1759a8f657a9b97e30c5978b0 (patch) | |
tree | 5f7274239b911ecb08e7dcfbef66780620de7231 /solc | |
parent | 892c3ef8efeb3a79c9e11722651f430f392071c6 (diff) | |
parent | 6f2865228cb02f0ba0b58990a9d3006dbe2692c6 (diff) | |
download | dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar.gz dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar.bz2 dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar.lz dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar.xz dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.tar.zst dexon-solidity-b96602122c2380b1759a8f657a9b97e30c5978b0.zip |
Merge pull request #3098 from ethereum/cli-cleanup
Cleanup some file/io reader in devcore
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 1686dc2e..fe1461b4 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -424,20 +424,13 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings() continue; } - m_sourceCodes[infile.string()] = dev::contentsString(infile.string()); + m_sourceCodes[infile.string()] = dev::readFileAsString(infile.string()); path = boost::filesystem::canonical(infile).string(); } m_allowedDirectories.push_back(boost::filesystem::path(path).remove_filename()); } if (addStdin) - { - string s; - while (!cin.eof()) - { - getline(cin, s); - m_sourceCodes[g_stdinFileName].append(s + '\n'); - } - } + m_sourceCodes[g_stdinFileName] = dev::readStandardInput(); } bool CommandLineInterface::parseLibraryOption(string const& _input) @@ -447,7 +440,7 @@ bool CommandLineInterface::parseLibraryOption(string const& _input) try { if (fs::is_regular_file(_input)) - data = contentsString(_input); + data = readFileAsString(_input); } catch (fs::filesystem_error const&) { @@ -698,7 +691,7 @@ bool CommandLineInterface::processInput() return ReadCallback::Result{false, "Not a valid file."}; else { - auto contents = dev::contentsString(canonicalPath.string()); + auto contents = dev::readFileAsString(canonicalPath.string()); m_sourceCodes[path.string()] = contents; return ReadCallback::Result{true, contents}; } @@ -731,13 +724,7 @@ bool CommandLineInterface::processInput() if (m_args.count(g_argStandardJSON)) { - string input; - while (!cin.eof()) - { - string tmp; - getline(cin, tmp); - input.append(tmp + "\n"); - } + string input = dev::readStandardInput(); StandardCompiler compiler(fileReader); cout << compiler.compile(input) << endl; return true; |