mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
* BugFix: Correct script function 'compareFileTimes' not going through the VFS when making the comparisons.
This commit is contained in:
parent
3dafdef5da
commit
a390e0d8d5
1 changed files with 23 additions and 7 deletions
|
|
@ -584,17 +584,33 @@ DefineEngineFunction(compareFileTimes, S32, (const char* fileA, const char* file
|
||||||
"@return S32. If value is 1, then fileA is newer. If value is -1, then fileB is newer. If value is 0, they are equal.\n"
|
"@return S32. If value is 1, then fileA is newer. If value is -1, then fileB is newer. If value is 0, they are equal.\n"
|
||||||
"@ingroup FileSystem")
|
"@ingroup FileSystem")
|
||||||
{
|
{
|
||||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileA);
|
Torque::FS::FileNodeRef nodeA = Torque::FS::GetFileNode(fileA);
|
||||||
|
Torque::FS::FileNodeRef nodeB = Torque::FS::GetFileNode(fileB);
|
||||||
|
|
||||||
FileTime fileATime = { 0 };
|
// Can't do anything if either file doesn't exist
|
||||||
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileATime);
|
if (!nodeA || !nodeB)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileB);
|
Torque::FS::FileNode::Attributes fileAAttributes;
|
||||||
|
Torque::FS::FileNode::Attributes fileABttributes;
|
||||||
|
|
||||||
FileTime fileBTime = { 0 };
|
// If retrieval of attributes fails, we can't compare
|
||||||
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileBTime);
|
if (!nodeA->getAttributes(&fileAAttributes) || !nodeB->getAttributes(&fileABttributes))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Platform::compareFileTimes(fileATime, fileBTime);
|
if (fileAAttributes.mtime > fileABttributes.mtime)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (fileAAttributes.mtime < fileABttributes.mtime)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue