File path to NSDocument

Tags ( )

Jesse,

If I wanted to have people set their mGTD documents explicitly in the pref panel (with an IB file browser), how could I match that document with open Mori docs?
Also, which point would I have to extend so that I would know when a user opens a new document?

I'm sorry if these things are clear and well documented, but I just can't find them tonight.

Thanks,
Jeff

I'm not sure what you mean

I'm not sure what you mean exactly. Are you saying that you have a file path, and want to find the Mori document that matches that path? If that's the case then I think you want to use [NSDocumentController documentForURL:]. In general NSDocumentController is the class that's responsible for creating and managing documents.

Sorry, here (and in my other

Sorry, here (and in my other post) I wasn't very clear about what I was hoping to do.

If I allowed the user to specify which Mori documents were their mGTD documents (and therefore which documents would have to be occasionally checked for updating) then could I find out if any of those documents are currently open in Mori.

In looking at the NSDocumentController class description it seems that I can use the method you described (documentForURL), to use the string (e.g. "\Users\jh\Desktop\moriGTD.mori" so I probably need to use something like initFileURLWithPath) to get a handle on the document if it's open at the time. Correct?

Yeah if you just have a

Yeah if you just have a string path, you'll need to first turn it into a URL, then you can use the document controller stuff. Also do you know about the

MIDocument - (void)setUserInfo:(id)newUserInfo forKey:(NSString *)key;

method? If you need to attached some info to a document (such as a boolean saying that it's a mGTD document, then that might be useful. I'm not really sure if that helps, but maybe.

must. go. to. bed. zzzz. :)

thanks for all the help. I

thanks for all the help. I look forward to giving these things a try.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.