mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-31 01:55:15 +00:00
Merge branch 'Preview4_0' into feature-vfs-security
This commit is contained in:
commit
161ffc62fe
3013 changed files with 348715 additions and 182470 deletions
|
|
@ -387,7 +387,17 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Torque::FS::IsFile(fileName);
|
||||
Torque::Path givenPath(fileName);
|
||||
|
||||
if (givenPath.getFileName().isEmpty() && givenPath.getExtension().isNotEmpty())
|
||||
{
|
||||
//specially named or hidden files, like .gitignore parse incorrectly due to having
|
||||
//"no" filename, so we adjust that
|
||||
givenPath.setFileName(String(".") + givenPath.getExtension());
|
||||
givenPath.setExtension("");
|
||||
}
|
||||
|
||||
return Torque::FS::IsFile(givenPath);
|
||||
}
|
||||
|
||||
DefineEngineFunction(isScriptFile, bool, (const char* fileName), ,
|
||||
|
|
@ -860,4 +870,20 @@ DefineEngineFunction( createPath, bool, ( const char* path ),,
|
|||
return Torque::FS::CreatePath(path);
|
||||
}
|
||||
|
||||
DefineEngineFunction(deleteDirectory, bool, (const char* path), ,
|
||||
"@brief Delete a directory from the hard drive\n\n"
|
||||
|
||||
"@param path Name and path of the folder to delete\n"
|
||||
"@note THERE IS NO RECOVERY FROM THIS. Deleted files are gone for good.\n"
|
||||
"@return True if file was successfully deleted\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static char fileName[1024];
|
||||
static char sandboxFileName[1024];
|
||||
|
||||
Con::expandScriptFilename(fileName, sizeof(fileName), path);
|
||||
Platform::makeFullPathName(fileName, sandboxFileName, sizeof(sandboxFileName));
|
||||
|
||||
return Platform::deleteDirectory(sandboxFileName);
|
||||
}
|
||||
#endif // TORQUE_TOOLS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue