Re: how to determine file path from a document's NSFileWrapper?
Re: how to determine file path from a document's NSFileWrapper?
- Subject: Re: how to determine file path from a document's NSFileWrapper?
- From: Steve Christensen <email@hidden>
- Date: Sun, 28 Dec 2003 11:02:39 -0800
Thanks, Louis. That was just what I needed. It'll really be nice once I
get the hang of Cocoa... :-)
steve
On Dec 27, 2003, at 11:18 PM, Louis C. Sacha wrote:
Sorry about that. I didn't actually re-read the documentation of
NSFileWrapper before posting that. I was looking at someone else's
code from an application that works with infomation stored in
ProjectBuilder projects (which are packages), and in part of its
loadFileWrapperRepresentation:ofType: it did this:
NSString *windowName = [[wrapper filename] lastPathComponent];
and I assumed that the NSFileWrapper method filename was similar to
NSDocument's fileName method. It's actually somewhat amusing that the
above code works the way the author intended...
Speaking of NSDocument's fileName method, it does provide the full
path, and it is set before the loadFileWrapperRepresentation:ofType:
method is called (at least it is in 10.2.x, and probably didn't change
in 10.3). So if your class is an NSDocument subclass, you should be
able to get the path by calling [self fileName] within the
loadFileWrapperRepresentation:ofType: method.
Hopefully that works better than my last suggestion :)
Louis
I'd already looked at -filename, but the comment next to its
declaration in NSFileWrapper.h says:
The filename is best thought of as the last known actual file name
of the wrapper. [...] It is just a filename, not a full path. Its
extension indicates its type.
Any other possibilities?
steve
On Dec 27, 2003, at 4:03 PM, Louis C. Sacha wrote:
Anyway, the NSFileWrapper method
- (NSString *)filename;
should return the path of the file wrapper.
My document package class has a NSFileWrapper passed to
-loadFileWrapperRepresentation:ofType:. This is fine except that I
need to determine the file path for some of the files within the
package (images, etc.) since methods in other classes expect either
a NSURL or a NSString containing the full path.
How can I determine, at the very least, the base path associated
with the document's file wrapper?
_______________________________________________
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.