Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Thomas Harte

macrumors 6502
Original poster
Nov 30, 2005
401
19
I'm implementing a small IDE-type program to target an old 8bit micro. It's heavily modelled on the Xcode condensed view, so just imagine that for the purposes of discussion. I've created a Cocoa project around the NSDocument architecture, with each of my documents being an individual project. So each of my NSDocument-derived projects includes a list of the various other files that make up the project.

One of the things I want to be able to do is to store the names of the files included in a project files in a relative format, relative to the project file. So files in the same folder will have no prefix, files in the folder one up would be ../whatever, etc.

As a result, I need some way of knowing what path my NSDocument-derived class is being saved to when it is saved. Sadly, I can't find one.

I'm aiming for 10.4 compatibility and I've so far tried implementing:

- (BOOL)writeToURL:eek:fType:error:

and:

- (NSData *)dataOfType:error:

writeToURL passes a temporary write location below /private/var/folders, so I'm not able to use it.

[self/super fileURL] seems not to be updated until after writeToURL or dataOfType have exited.

Is there anything I can do without replacing the entire save/save as behaviour?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.