• 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
NSDocument with documents being folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDocument with documents being folders


  • Subject: NSDocument with documents being folders
  • From: James Mastro <email@hidden>
  • Date: Mon, 8 Dec 2003 16:35:34 -0500

Hello list,

My application writes its data as a folder of data, but not as a package. I want to use NSDocument in my application. Googling for info eventually led me to implement the following methods:

- (BOOL) writeToFile:(NSString *)fileName ofType:(NSString *)type;
- (BOOL) writeToURL:(NSURL *)url ofType:(NSString *)type;
- (BOOL) readFromFile:(NSString *)fileName ofType:(NSString *)type;
- (BOOL) readFromURL:(NSURL *)url ofType:(NSString *)type;

To allow opening of a folder, I had to subclass NSDocumentController and call [openPanel setCanChooseDirectories: YES] when it came time to show the open panel. In my quick testing, this seems to work fine. You can select a folder, it's path is sent to readFromFile, and the document is created.

However, I read a 2001 post on the web (that I can't find right now) that mentioned a few problems when doing what I'm doing. Is this still the case? I just want to know if what I am doing here is OK, or if I'm going to run into problems later.

-jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSDocument with documents being folders
      • From: James Mastro <email@hidden>
  • Prev by Date: Re: .webloc files and Safari (newbie)
  • Next by Date: Re: NSDocument with documents being folders
  • Previous by thread: How to use a custom field editor in a System Pref panel?
  • Next by thread: Re: NSDocument with documents being folders
  • Index(es):
    • Date
    • Thread