PDA

View Full Version : QFileInfo::created() Problem Under POSIX!!



Mans
15th May 2011, 19:51
It is known that QFileInfo::created() does not get me the creation date and time for a file, but the last modified date. So, how can I get the true creation date under POSIX, that's Mac, Linux, etc.?

Thank you.

SixDegrees
15th May 2011, 21:17
Unix doesn't store the file creation time; it only stores the most recent modification time, which can be changed by a mv, permission change or several other ways.

ChrisW67
16th May 2011, 01:24
A POSIX file inode has last changed (ctime, changing time), the file content last modified (mtime, modification time), and last accessed (atime, access time). Some filesystems don't maintain the access time.

You can get the create time on Windows systems using their API, http://support.microsoft.com/kb/188977, but I think their POSIX layer also returns the creation time (where supported) in the ctime member. OS X stores creation date in metadata associated with the file but you'd have to look at how that can be retrieved.

DanH
16th May 2011, 03:34
Pop up a query and ask the user when he created the file.