| 571 | } |
| 572 | |
| 573 | bool 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 | |
| 598 | bool MountSystem::_dumpDirectories(DirectoryRef directory, Vector<StringTableEntry>& directories, S32 depth, bool noBasePath, S32 currentDepth, const Path& basePath) |
| 599 | { |