views:

32

answers:

1

Hey guys, I am trying to get the path that an NSDocument is being saved to at save time. I tried overriding writeToURL but that would pass me an obscure temp file URL, which was not where it was getting saved. Also asking the document like this [document fileURL] only works after it has been saved. I can get the path when it is loaded but I need some way for that initial save. Is there a way I can get the real file path when an NSDocument is saved?

+1  A: 

It would really help if you told us more about why you want this.

That said, the lowest level method with this information is -writeSafelyToURL:ofType:forSaveOperation:error:

Mike Abdullah
Can I override this instead of writeToURL?
Justin Meiners
Yes, hence why I mentioned it. Overriding `-saveToURL:ofType:forSaveOperation:error:` should do the job best I imagine.
Mike Abdullah
@Mike Abdullah Ok thanks, sorry I was just making sure because I thought it might be something I would have to override in addition to it.
Justin Meiners