MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / copyFile

Method copyFile

Engine/source/core/volume.cpp:573–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573bool MountSystem::copyFile(const Path& source, const Path& destination, bool noOverwrite)
574{
575 // Exit out early if we're not overriding
576 if (isFile(destination) && noOverwrite)
577 {
578 return true;
579 }
580
581 FileRef sourceFile = openFile(source, FS::File::AccessMode::Read);
582 if (!sourceFile)
583 return false;
584
585 const U64 sourceFileSize = sourceFile->getSize();
586
587 void* writeBuffer = dMalloc(sourceFileSize);
588 sourceFile->read(writeBuffer, sourceFileSize);
589
590 FileRef destinationFile = openFile(destination, FS::File::AccessMode::Write);
591 const bool success = destinationFile->write(writeBuffer, sourceFileSize) == sourceFileSize;
592
593 dFree(writeBuffer);
594
595 return success;
596}
597
598bool MountSystem::_dumpDirectories(DirectoryRef directory, Vector<StringTableEntry>& directories, S32 depth, bool noBasePath, S32 currentDepth, const Path& basePath)
599{

Callers 1

CopyFileFunction · 0.80

Calls 4

dFreeFunction · 0.50
getSizeMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected