• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Locking Files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Locking Files?
      • From: Vince DeMarco <email@hidden>
References: 
 >Locking Files? (From: "Josh M. Hurd" <email@hidden>)

  • Prev by Date: Re: Mac OS X 10.1 File Name Extension Guidelines
  • Next by Date: RE: Memory fragmentation
  • Previous by thread: Re: Locking Files?
  • Next by thread: Re: Locking Files?
  • Index(es):
    • Date
    • Thread