Browse Source

Don't try to change permissions of path when creating file if path

already exists.
cl-refactor
Gav Wood 10 years ago
parent
commit
d8a7b5f46c
  1. 5
      libdevcore/CommonIO.cpp

5
libdevcore/CommonIO.cpp

@ -118,8 +118,11 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe
{ {
// create directory if not existent // create directory if not existent
fs::path p(_file); fs::path p(_file);
if (!fs::exists(p.parent_path()))
{
fs::create_directories(p.parent_path()); fs::create_directories(p.parent_path());
fs::permissions(p.parent_path(), fs::owner_all); DEV_IGNORE_EXCEPTIONS(fs::permissions(p.parent_path(), fs::owner_all));
}
ofstream s(_file, ios::trunc | ios::binary); ofstream s(_file, ios::trunc | ios::binary);
s.write(reinterpret_cast<char const*>(_data.data()), _data.size()); s.write(reinterpret_cast<char const*>(_data.data()), _data.size());

Loading…
Cancel
Save