diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-04 15:03:33 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-04 15:03:33 +0100 |
commit | 903d996e10401ec93a03b813cbc6ac4ace6a5dfa (patch) | |
tree | 71a6b7690b3d1e15d1ae2a1887a4787eecb55e4e /src/Storage.cpp | |
parent | c22aab0620c79a80535c85c0dad87a1f288a884c (diff) |
Test caching filter in matrix
Diffstat (limited to 'src/Storage.cpp')
-rw-r--r-- | src/Storage.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Storage.cpp b/src/Storage.cpp index 086f6d8..dadff5b 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -157,6 +157,15 @@ namespace QuickMedia { return file_overwrite(path, data.c_str(), data.size()); } + int file_overwrite_atomic(const Path &path, const std::string &data) { + Path tmp_path = path; + tmp_path.append(".tmp"); + int res = file_overwrite(tmp_path, data.c_str(), data.size()); + if(res != 0) + return res; + return rename(tmp_path.data.c_str(), path.data.c_str()); + } + void for_files_in_dir(const Path &path, FileIteratorCallback callback) { try { for(auto &p : std::filesystem::directory_iterator(path.data)) { |