I have implemented window state restauration in an app. This works fine for 
re-opening documents that were open when the app was last quit. What I now want 
to do is extend that functionality to files that were not necessarily open when 
the app was last quit, but simply that have been opened at any time before. I 
can't put state information into the files themselves, since they are files 
that need to remain clean and that are not "owned" by my app.

From what I've researched so far the window state restoration feature won't 
extend the way I need it.

I think NSURL's bookmarks feature could help out. I could create bookmark data, 
and save it, and then later, when a file is opened, check the cached 
bookmarkdata to see if one resolves to a URL that is equal to the url of the 
just opened file. That should even work if the file is moved between sessions. 
Is this the best way to do it though?

The next question is, what is a handy way to keep track of the restoration data 
that goes with the URL, since that will have to be saved separately from the 
bookmark data. Using only the file name won't do, I need some kind of unique 
ID, or a unique URL that can be derived from the bookmark data.  I know I can 
think up a scheme, but I wonder if there is a proper way to do this, like 
obtaining a unique file ID.

-António

----------------------------------------------------
A merry heart does good like medicine
----------------------------------------------------



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to