diff options
author | chriseth <chris@ethereum.org> | 2018-10-19 01:16:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 01:16:31 +0800 |
commit | 99dc869eb9965b3830c83a2e7464acf7353a9bad (patch) | |
tree | b841045ae5bec47e412c4736927cff722a0d41c2 /libdevcore/CommonIO.cpp | |
parent | 4987c12ac3fa16daec6df090a422890ef2823ff4 (diff) | |
parent | 0690aae09d1591b65d6808e6c6c547b63ddb3ce9 (diff) | |
download | dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar.gz dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar.bz2 dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar.lz dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar.xz dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.tar.zst dexon-solidity-99dc869eb9965b3830c83a2e7464acf7353a9bad.zip |
Merge pull request #5259 from ethereum/cleanup8
Cleanup in some base utils
Diffstat (limited to 'libdevcore/CommonIO.cpp')
-rw-r--r-- | libdevcore/CommonIO.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 1aa3504c..cc730575 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -80,45 +80,6 @@ string dev::readStandardInput() return ret; } -void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename) -{ - namespace fs = boost::filesystem; - if (_writeDeleteRename) - { - fs::path tempPath = fs::unique_path(_file + "-%%%%%%"); - writeFile(tempPath.string(), _data, false); - // will delete _file if it exists - fs::rename(tempPath, _file); - } - else - { - // create directory if not existent - fs::path p(_file); - if (!p.parent_path().empty() && !fs::exists(p.parent_path())) - { - fs::create_directories(p.parent_path()); - try - { - fs::permissions(p.parent_path(), fs::owner_all); - } - catch (...) - { - } - } - - ofstream s(_file, ios::trunc | ios::binary); - s.write(reinterpret_cast<char const*>(_data.data()), _data.size()); - assertThrow(s, FileError, "Could not write to file: " + _file); - try - { - fs::permissions(_file, fs::owner_read|fs::owner_write); - } - catch (...) - { - } - } -} - #if defined(_WIN32) class DisableConsoleBuffering { |