mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename contentsString to readFileAsString
This commit is contained in:
parent
f67d34e4ec
commit
7186e142b8
@ -39,7 +39,7 @@ namespace
|
||||
{
|
||||
|
||||
template <typename _T>
|
||||
inline _T contentsGeneric(std::string const& _file)
|
||||
inline _T readFile(std::string const& _file)
|
||||
{
|
||||
_T ret;
|
||||
size_t const c_elementSize = sizeof(typename _T::value_type);
|
||||
@ -61,9 +61,9 @@ inline _T contentsGeneric(std::string const& _file)
|
||||
|
||||
}
|
||||
|
||||
string dev::contentsString(string const& _file)
|
||||
string dev::readFileAsString(string const& _file)
|
||||
{
|
||||
return contentsGeneric<string>(_file);
|
||||
return readFile<string>(_file);
|
||||
}
|
||||
|
||||
void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename)
|
||||
|
@ -32,7 +32,7 @@ namespace dev
|
||||
|
||||
/// Retrieve and returns the contents of the given file as a std::string.
|
||||
/// If the file doesn't exist or isn't readable, returns an empty container / bytes.
|
||||
std::string contentsString(std::string const& _file);
|
||||
std::string readFileAsString(std::string const& _file);
|
||||
|
||||
/// Write the given binary data into the given file, replacing the file if it pre-exists.
|
||||
/// Throws exception on error.
|
||||
|
@ -127,7 +127,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
src = contentsString(infile);
|
||||
src = readFileAsString(infile);
|
||||
|
||||
vector<string> errors;
|
||||
if (src.empty())
|
||||
@ -140,7 +140,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
else if (mode == Binary || mode == Hex)
|
||||
{
|
||||
auto bs = compileLLL(src, optimise ? true : false, &errors, contentsString);
|
||||
auto bs = compileLLL(src, optimise ? true : false, &errors, readFileAsString);
|
||||
if (mode == Hex)
|
||||
cout << toHex(bs) << endl;
|
||||
else if (mode == Binary)
|
||||
@ -152,7 +152,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
else if (mode == Assembly)
|
||||
{
|
||||
cout << compileLLLToAsm(src, optimise ? true : false, &errors, contentsString) << endl;
|
||||
cout << compileLLLToAsm(src, optimise ? true : false, &errors, readFileAsString) << endl;
|
||||
}
|
||||
|
||||
for (auto const& i: errors)
|
||||
|
@ -424,7 +424,7 @@ 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());
|
||||
@ -447,7 +447,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 +698,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};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user