MCPcopy Create free account
hub / github.com/comaps/comaps / MoveFileX

Function MoveFileX

libs/coding/internal/file_data.cpp:217–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217bool 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
234bool WriteToTempAndRenameToFile(string const & dest, function<bool(string const &)> const & write, string const & tmp)
235{

Calls 2

CopyFileXFunction · 0.85
DeleteFileXFunction · 0.85

Tested by

no test coverage detected