Remove mostly unused writeFile implementation.

This commit is contained in:
chriseth committed 2018-10-18 12:50:06 +02:00
1 parent 7609e2871e
commit 0690aae09d
3 files changed
+9 -48

No files matched your search

-39
View File
@@ -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
{