CopyFile
This function copies a file from one location to another.
Syntax
- static bool CopyFile(const std::string& src, const std::string& dst)
Parameters
- src: this is the path of the file to copy.
- dst: this is the path to the new file that will be created.
Remarks
This function does not work on platforms that use virtual file systems, as mobile does.
This function will have no effect if Lua sandboxing is enabled.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
Entity* entity = NULL;
int main(int argc, const char *argv[])
{
//Create a file
std::string path = "MyFile.txt";
FileSystem::CreateFile(path);
//Copy the file "MyFile.txt" as "MyFile2.txt"
std::string newpath = FileSystem::StripExt(path)+"2."+FileSystem::ExtractExt(path);
FileSystem::CopyFile(path,newpath);
return 0;
}