| 477 | } |
| 478 | |
| 479 | bool tryAtomicRename(const MMKVPath_t &srcPath, const MMKVPath_t &dstPath) { |
| 480 | if (MoveFileEx(srcPath.c_str(), dstPath.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED) == 0) { |
| 481 | const auto &utf8SrcPath = MMKVPath_t2String(srcPath); |
| 482 | const auto &utf8DstPath = MMKVPath_t2String(dstPath); |
| 483 | MMKVError("MoveFileEx [%s] to [%s] failed %d", utf8SrcPath.c_str(), utf8DstPath.c_str(), GetLastError()); |
| 484 | return false; |
| 485 | } |
| 486 | return true; |
| 487 | } |
| 488 | |
| 489 | bool copyFileContent(const MMKVPath_t &srcPath, MMKVFileHandle_t dstFD, bool needTruncate) { |
| 490 | if (dstFD == INVALID_HANDLE_VALUE) { |
no test coverage detected