| 307 | } |
| 308 | |
| 309 | bool save_file(const std::string &filepath, const void *buf, size_t size) { |
| 310 | try { |
| 311 | FileStream fs(filepath, platform::O_CREATE_ALWAYS); |
| 312 | fs.write(buf, size); |
| 313 | } catch (const std::exception &) { |
| 314 | return false; |
| 315 | } |
| 316 | return true; |
| 317 | } |
| 318 | bool atomic_save_file(const std::string &filepath, const void *buf, size_t size, const std::string &tmp_filepath) { |
| 319 | try { |
| 320 | FileStream fs(tmp_filepath, platform::O_CREATE_ALWAYS); |
no test coverage detected