• 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: how to determine file path from a document's NSFileWrapper?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to determine file path from a document's NSFileWrapper?


  • Subject: Re: how to determine file path from a document's NSFileWrapper?
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Sat, 27 Dec 2003 23:18:53 -0800

Hello...

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.

  • Follow-Ups:
    • Re: how to determine file path from a document's NSFileWrapper?
      • From: Steve Christensen <email@hidden>
References: 
 >how to determine file path from a document's NSFileWrapper? (From: Steve Christensen <email@hidden>)
 >Re: how to determine file path from a document's NSFileWrapper? (From: "Louis C. Sacha" <email@hidden>)
 >Re: how to determine file path from a document's NSFileWrapper? (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: how to determine file path from a document's NSFileWrapper?
  • Next by Date: Re: How do I know the screensaver is active?
  • Previous by thread: Re: how to determine file path from a document's NSFileWrapper?
  • Next by thread: Re: how to determine file path from a document's NSFileWrapper?
  • Index(es):
    • Date
    • Thread