MCPcopy Create free account
hub / github.com/Tencent/MMKV / tryAtomicRename

Function tryAtomicRename

Core/MemoryFile_Win32.cpp:479–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479bool 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
489bool copyFileContent(const MMKVPath_t &srcPath, MMKVFileHandle_t dstFD, bool needTruncate) {
490 if (dstFD == INVALID_HANDLE_VALUE) {

Callers 1

copyFileFunction · 0.70

Calls 1

MMKVPath_t2StringFunction · 0.85

Tested by

no test coverage detected