• 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
How to know if a file has been opened before?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to know if a file has been opened before?


  • Subject: How to know if a file has been opened before?
  • From: Antonio Nunes <email@hidden>
  • Date: Mon, 04 Jun 2012 23:50:16 +0100

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to know if a file has been opened before?
      • From: Michael Hall <email@hidden>
    • Re: How to know if a file has been opened before?
      • From: Graham Cox <email@hidden>
    • Re: How to know if a file has been opened before?
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: can't hide scrollbar on NSTableView
  • Next by Date: How to get SDK 10.5 on XCode 4?
  • Previous by thread: Re: can't hide scrollbar on NSTableView
  • Next by thread: Re: How to know if a file has been opened before?
  • Index(es):
    • Date
    • Thread