* Feature: Augment VFS file information with creation times & update some console functions to use VFS.

This commit is contained in:
Robert MacGregor 2021-12-18 03:56:11 -05:00
parent 277cdf67b0
commit 948bc43d85
7 changed files with 36 additions and 23 deletions

View file

@ -46,7 +46,8 @@ namespace Torque
mBuffer = dMalloc(mBufferSize);
dMemset(mBuffer, 0, mBufferSize);
mModified = Time::getCurrentTime();
mLastAccess = mModified;
mLastAccess = mModified;
mCreated = mModified;
mFileSystem = fs;
}
@ -62,6 +63,7 @@ namespace Torque
attr->size = mFileSize;
attr->mtime = mModified;
attr->atime = mLastAccess;
attr->ctime = mCreated;
return true;
}
@ -81,6 +83,7 @@ namespace Torque
U32 mBufferSize; // This is the size of the memory buffer >= mFileSize
U32 mFileSize; // This is the size of the "file" <= mBufferSize
Time mModified; // Last modified
Time mCreated; // When Created
Time mLastAccess; // Last access
MemFileSystem* mFileSystem;
};
@ -508,4 +511,4 @@ namespace Torque
}
} // Namespace Mem
} // Namespace Torque
} // Namespace Torque

View file

@ -86,6 +86,7 @@ public:
// use the mod time for both mod and access time, since we only have mod time in the CD
attr->mtime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->atime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->ctime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->size = mZipEntry->mCD.mUncompressedSize;
return true;
@ -197,6 +198,7 @@ public:
// use the mod time for both mod and access time, since we only have mod time in the CD
attr->mtime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->atime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->ctime = ZipArchive::DOSTimeToTime(mZipEntry->mCD.mModTime, mZipEntry->mCD.mModDate);
attr->size = mZipEntry->mCD.mUncompressedSize;
return true;
@ -291,6 +293,7 @@ public:
ZipArchive::ZipEntry* zipEntry = mArchive->getRoot();
attr->mtime = ZipArchive::DOSTimeToTime(zipEntry->mCD.mModTime, zipEntry->mCD.mModDate);
attr->atime = ZipArchive::DOSTimeToTime(zipEntry->mCD.mModTime, zipEntry->mCD.mModDate);
attr->ctime = ZipArchive::DOSTimeToTime(zipEntry->mCD.mModTime, zipEntry->mCD.mModDate);
attr->size = zipEntry->mCD.mUncompressedSize;
return true;

View file

@ -273,6 +273,18 @@ Time FileNode::getModifiedTime()
return attrs.mtime;
}
Time FileNode::getCreatedTime()
{
Attributes attrs;
bool success = getAttributes(&attrs);
if (!success)
return Time();
return attrs.ctime;
}
U64 FileNode::getSize()
{
Attributes attrs;

View file

@ -114,6 +114,7 @@ public:
String name; ///< File/Directory name
Time mtime; ///< Last modified time
Time atime; ///< Last access time
Time ctime; ///< Creation Time
U64 size;
};
@ -128,6 +129,7 @@ public:
// Convenience routines - may be overridden for optimal access
virtual Time getModifiedTime(); ///< @note This will return Time() on failure
virtual Time getCreatedTime(); ///< @note This will return Time() on failure
virtual U64 getSize(); ///< @note This will return 0 on failure
virtual U32 getChecksum(); ///< @note This will return 0 on failure