mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-02 20:10:32 +00:00
* Feature: Initial secure VFS implementation with asset import capability.
This commit is contained in:
parent
d9bedbe31c
commit
277cdf67b0
12 changed files with 220 additions and 10 deletions
|
|
@ -500,6 +500,28 @@ Path MountSystem::_normalize(const Path& path)
|
|||
return po;
|
||||
}
|
||||
|
||||
bool MountSystem::copyFile(const Path& source, const Path& destination, bool noOverwrite)
|
||||
{
|
||||
// Exit out early if we're not overriding
|
||||
if (isFile(destination) && noOverwrite)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
FileRef sourceFile = openFile(source, FS::File::AccessMode::Read);
|
||||
const U64 sourceFileSize = sourceFile->getSize();
|
||||
|
||||
void* writeBuffer = dMalloc(sourceFileSize);
|
||||
sourceFile->read(writeBuffer, sourceFileSize);
|
||||
|
||||
FileRef destinationFile = openFile(destination, FS::File::AccessMode::Write);
|
||||
const bool success = destinationFile->write(writeBuffer, sourceFileSize) == sourceFileSize;
|
||||
|
||||
dFree(writeBuffer);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
FileRef MountSystem::createFile(const Path& path)
|
||||
{
|
||||
Path np = _normalize(path);
|
||||
|
|
@ -909,6 +931,11 @@ FileRef CreateFile(const Path &path)
|
|||
return sgMountSystem.createFile(path);
|
||||
}
|
||||
|
||||
bool CopyFile(const Path& source, const Path& destination, bool noOverwrite)
|
||||
{
|
||||
return sgMountSystem.copyFile(source, destination, noOverwrite);
|
||||
}
|
||||
|
||||
DirectoryRef CreateDirectory(const Path &path)
|
||||
{
|
||||
return sgMountSystem.createDirectory(path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue