Re: Locking Files?
Re: Locking Files?
- Subject: Re: Locking Files?
- From: Rosyna <email@hidden>
- Date: Fri, 7 Sep 2001 14:36:10 -0700
It requires carbon be used.
NSString* path=alreadyExistingPath;
FSRef theRef;
FSCatalogInfo catInfo;
OSErr err=noErr;
err=FSPathMakeRef([path UTF8String],&theRef,NULL);
// check for err here. noErr==0
err=FSGetCatalogInfo(&theRef,kFSCatInfoNodeFlags,&catInfo,NULL,NULL,NULL);
// check for err here.
if ( [locked state] )
catInfo.nodeFlags |= kFSNodeLockedMask;
else
catInfo.nodeFlags &= ~kFSNodeLockedMask;
err=FSSetCatalogInfo(&theRef,kFSCatInfoNodeFlags,&catInfo);
//check for err here.
Ack, at 9/7/01, Josh M. Hurd said:
Is it possible to lock and unlock files in Cocoa? I checked the
NSFileManger docs but it doesn't seem to mention anything about
locking files. I also checked the Functions section for Foundation
and AppKit. Do I have to resort to using Carbon functions? I'd
rather not if possible.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insane People