|
|
| version 1.2, 2004/01/11 16:58:47 | version 1.3, 2004/01/23 17:37:39 |
|---|---|
| Line 213 short file_delete(const char *path) { | Line 213 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 226 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 { | else { |
| return(FILEATTR_ARCHIVE); | ret = FILEATTR_ARCHIVE; |
| } | } |
| #else | if (fsci.nodeFlags & kFSNodeLockedMask) { |
| Str255 fname; | ret |= FILEATTR_READONLY; |
| 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 (PBGetCatInfo(&pb, false) != noErr) { | return(ret); |
| return(-1); | |
| } | |
| if (pb.hFileInfo.ioFlAttrib & 0x10) { | |
| return(FILEATTR_DIRECTORY); | |
| } | |
| else { | |
| return(FILEATTR_ARCHIVE); | |
| } | |
| #endif | |
| } | } |
| short file_dircreate(const char *path) { | short file_dircreate(const char *path) { |