File.getCreationTime() OSX (bug/misbehaviour)


#1

File.getCreationTime() on a folder gives back the last time the folder has changed, and not its “birth time”.

The right information is st_birthtime, st_ctime means change-time

#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec
#define st_ctime st_ctimespec.tv_sec
#define st_birthtime st_birthtimespec.tv_sec


#2

Hmmm seems this has already been fixed, quite a while back:


#3

Hi Fabian,

no, there is a second getCreationTime in juce_Files.cpp

Time File::getCreationTime() const { int64 m, a, c; getFileTimesInternal (m, a, c); return Time (c); }

which calls in juce_posix_SharedCode.h

void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int64& creationTime) const
{
    modificationTime = 0;
    accessTime = 0;
    creationTime = 0;

    juce_statStruct info;

    if (juce_stat (fullPath, info))
    {
        modificationTime  = (int64) info.st_mtime * 1000;
        accessTime        = (int64) info.st_atime * 1000;
        creationTime      = (int64) info.st_ctime * 1000;
    }
}

#4

OK thanks - this is now fixed on develop with commit ee4993f.