MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / copyFile

Method copyFile

Libraries/FileSystem/FileSystem.cpp:1216–1229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1214}
1215
1216SC::Result SC::FileSystem::Operations::copyFile(StringSpan source, StringSpan destination, FileSystemCopyFlags flags)
1217{
1218 SC_TRY_MSG(Internal::validatePath(source), "copyFile: Invalid source path");
1219 SC_TRY_MSG(Internal::validatePath(destination), "copyFile: Invalid destination path");
1220
1221 DWORD copyFlags = COPY_FILE_FAIL_IF_EXISTS;
1222 if (flags.overwrite)
1223 copyFlags &= ~COPY_FILE_FAIL_IF_EXISTS;
1224
1225 SC_TRY_WIN32(CopyFileExW(source.getNullTerminatedNative(), destination.getNullTerminatedNative(), nullptr, nullptr,
1226 nullptr, copyFlags),
1227 "copyFile: Failed to copy file");
1228 return Result(true);
1229}
1230
1231SC::Result SC::FileSystem::Operations::copyDirectory(StringSpan source, StringSpan destination,
1232 FileSystemCopyFlags flags)

Callers

nothing calls this directly

Calls 9

copyFileFunction · 0.85
MakeDeferredFunction · 0.85
removeFunction · 0.85
makeDirectoryFunction · 0.85
StringSpanFunction · 0.85
closeFunction · 0.85
readFunction · 0.85
ResultClass · 0.50
ErrorEnum · 0.50

Tested by

no test coverage detected