NSDocument with documents being folders
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.