| 215 | } |
| 216 | |
| 217 | bool MoveFileX(string const & fOld, string const & fNew) |
| 218 | { |
| 219 | // Try to rename the file first. |
| 220 | int res = rename(fOld.c_str(), fNew.c_str()); |
| 221 | if (res == 0) |
| 222 | return true; |
| 223 | |
| 224 | // Otherwise perform the full move. |
| 225 | if (!CopyFileX(fOld, fNew)) |
| 226 | { |
| 227 | (void)DeleteFileX(fNew); |
| 228 | return false; |
| 229 | } |
| 230 | (void)DeleteFileX(fOld); |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | bool WriteToTempAndRenameToFile(string const & dest, function<bool(string const &)> const & write, string const & tmp) |
| 235 | { |
no test coverage detected