Navigation Menu

Skip to content

Commit

Permalink
Implemented __PHYSFS_platformGetLastModTime().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 25, 2002
1 parent b89b1ac commit c1be813
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion platform/macclassic.c
Expand Up @@ -808,7 +808,27 @@ void __PHYSFS_platformReleaseMutex(void *mutex)

PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
{
BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); /* !!! FIXME! */
FSSpec spec;
CInfoPBRec infoPB;
UInt32 modDate;

BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, ERR_OS_ERROR, -1);

memset(&infoPB, '\0', sizeof (CInfoPBRec));
infoPB.dirInfo.ioNamePtr = spec.name;
infoPB.dirInfo.ioVRefNum = spec.vRefNum;
infoPB.dirInfo.ioDrDirID = spec.parID;
infoPB.dirInfo.ioFDirIndex = 0;
BAIL_IF_MACRO(PBGetCatInfoSync(&infoPB) != noErr, ERR_OS_ERROR, -1);

modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ?
infoPB.dirInfo.ioDrMdDat : infoPB.hFileInfo.ioFlMdDat;

/* epoch is different on MacOS. They use Jan 1, 1904, apparently. */
/* subtract seconds between those epochs, counting leap years. */
modDate -= 2082844800;

return((PHYSFS_sint64) modDate);
} /* __PHYSFS_platformGetLastModTime */

/* end of macclassic.c ... */
Expand Down

0 comments on commit c1be813

Please sign in to comment.