--- np2/macosx/dosio.cpp 2004/01/11 16:58:47 1.2 +++ np2/macosx/dosio.cpp 2005/05/20 17:25:03 1.5 @@ -170,27 +170,13 @@ short file_getdatetime(FILEH handle, DOS FSRef ref; FSCatalogInfo fsci; - LocalDateTime ldt; - DateTimeRec dtr; - ZeroMemory(&dtr, sizeof(dtr)); if ((FSGetForkCBInfo(handle, 0, NULL, NULL, NULL, &ref, NULL) != noErr) || (FSGetCatalogInfo(&ref, kFSCatInfoContentMod, &fsci, NULL, NULL, NULL) != noErr)) { return(-1); } - ConvertUTCToLocalDateTime(&fsci.contentModDate, &ldt); - 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; - } + cnvdatetime(&fsci.contentModDate, dosdate, dostime); return(0); #else (void)handle; @@ -213,11 +199,11 @@ short file_delete(const char *path) { short file_attr(const char *path) { -#ifdef TARGET_API_MAC_CARBON Str255 fname; FSSpec fss; FSRef fsr; FSCatalogInfo fsci; + short ret; mkstr255(fname, path); if ((FSMakeFSSpec(0, 0, fname, &fss) != noErr) || @@ -226,38 +212,16 @@ short file_attr(const char *path) { NULL, NULL, NULL) != noErr)) { return(-1); } - else if (fsci.nodeFlags & kFSNodeIsDirectoryMask) { - return(FILEATTR_DIRECTORY); + if (fsci.nodeFlags & kFSNodeIsDirectoryMask) { + ret = FILEATTR_DIRECTORY; } else { - return(FILEATTR_ARCHIVE); + ret = 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 { - pb.dirInfo.ioFDirIndex = 0; + if (fsci.nodeFlags & kFSNodeLockedMask) { + ret |= FILEATTR_READONLY; } - if (PBGetCatInfo(&pb, false) != noErr) { - return(-1); - } - if (pb.hFileInfo.ioFlAttrib & 0x10) { - return(FILEATTR_DIRECTORY); - } - else { - return(FILEATTR_ARCHIVE); - } -#endif + return(ret); } short file_dircreate(const char *path) { @@ -474,9 +438,9 @@ void file_catname(char *path, const char } } -char *file_getname(char *path) { +char *file_getname(const char *path) { - char *ret; + const char *ret; ret = path; while(*path != '\0') { @@ -484,7 +448,7 @@ char *file_getname(char *path) { ret = path; } } - return(ret); + return((char *)ret); } void file_cutname(char *path) { @@ -495,7 +459,7 @@ void file_cutname(char *path) { p[0] = '\0'; } -char *file_getext(char *path) { +char *file_getext(const char *path) { char *p; char *q;