|
|
| version 1.2, 2004/01/11 16:58:47 | version 1.4, 2004/01/31 19:45:25 |
|---|---|
| Line 170 short file_getdatetime(FILEH handle, DOS | Line 170 short file_getdatetime(FILEH handle, DOS |
| FSRef ref; | FSRef ref; |
| FSCatalogInfo fsci; | FSCatalogInfo fsci; |
| LocalDateTime ldt; | |
| DateTimeRec dtr; | |
| ZeroMemory(&dtr, sizeof(dtr)); | |
| if ((FSGetForkCBInfo(handle, 0, NULL, NULL, NULL, &ref, NULL) != noErr) || | if ((FSGetForkCBInfo(handle, 0, NULL, NULL, NULL, &ref, NULL) != noErr) || |
| (FSGetCatalogInfo(&ref, kFSCatInfoContentMod, &fsci, NULL, NULL, NULL) | (FSGetCatalogInfo(&ref, kFSCatInfoContentMod, &fsci, NULL, NULL, NULL) |
| != noErr)) { | != noErr)) { |
| return(-1); | return(-1); |
| } | } |
| ConvertUTCToLocalDateTime(&fsci.contentModDate, &ldt); | cnvdatetime(&fsci.contentModDate, dosdate, dostime); |
| SecondsToDate(ldt.lowSeconds, &dtr); | |
| if (dosdate) { | |
| dosdate->year = dtr.year; | |
| dosdate->month = (BYTE)dtr.month; | |
| dosdate->day = (BYTE)dtr.day; | |
| } | |
| if (dostime) { | |
| dostime->hour = (BYTE)dtr.hour; | |
| dostime->minute = (BYTE)dtr.minute; | |
| dostime->second = (BYTE)dtr.second; | |
| } | |
| return(0); | return(0); |
| #else | #else |
| (void)handle; | (void)handle; |
| Line 213 short file_delete(const char *path) { | Line 199 short file_delete(const char *path) { |
| short file_attr(const char *path) { | short file_attr(const char *path) { |
| #ifdef TARGET_API_MAC_CARBON | |
| Str255 fname; | Str255 fname; |
| FSSpec fss; | FSSpec fss; |
| FSRef fsr; | FSRef fsr; |
| FSCatalogInfo fsci; | FSCatalogInfo fsci; |
| short ret; | |
| mkstr255(fname, path); | mkstr255(fname, path); |
| if ((FSMakeFSSpec(0, 0, fname, &fss) != noErr) || | if ((FSMakeFSSpec(0, 0, fname, &fss) != noErr) || |
| Line 226 short file_attr(const char *path) { | Line 212 short file_attr(const char *path) { |
| NULL, NULL, NULL) != noErr)) { | NULL, NULL, NULL) != noErr)) { |
| return(-1); | return(-1); |
| } | } |
| else if (fsci.nodeFlags & kFSNodeIsDirectoryMask) { | if (fsci.nodeFlags & kFSNodeIsDirectoryMask) { |
| return(FILEATTR_DIRECTORY); | ret = FILEATTR_DIRECTORY; |
| } | |
| else { | |
| return(FILEATTR_ARCHIVE); | |
| } | |
| #else | |
| Str255 fname; | |
| FSSpec fss; | |
| CInfoPBRec pb; | |
| mkstr255(fname, path); | |
| FSMakeFSSpec(0, 0, fname, &fss); | |
| pb.dirInfo.ioNamePtr = fss.name; | |
| pb.dirInfo.ioVRefNum = fss.vRefNum; | |
| pb.dirInfo.ioDrDirID = fss.parID; | |
| if (fss.name[0] == 0) { | |
| pb.dirInfo.ioFDirIndex = -1; | |
| } | } |
| else { | else { |
| pb.dirInfo.ioFDirIndex = 0; | ret = FILEATTR_ARCHIVE; |
| } | |
| if (PBGetCatInfo(&pb, false) != noErr) { | |
| return(-1); | |
| } | } |
| if (pb.hFileInfo.ioFlAttrib & 0x10) { | if (fsci.nodeFlags & kFSNodeLockedMask) { |
| return(FILEATTR_DIRECTORY); | ret |= FILEATTR_READONLY; |
| } | } |
| else { | return(ret); |
| return(FILEATTR_ARCHIVE); | |
| } | |
| #endif | |
| } | } |
| short file_dircreate(const char *path) { | short file_dircreate(const char *path) { |