Re: How to know if a file has been opened before?
Re: How to know if a file has been opened before?
- Subject: Re: How to know if a file has been opened before?
- From: "Stephen J. Butler" <email@hidden>
- Date: Tue, 05 Jun 2012 08:45:13 -0500
On Tue, Jun 5, 2012 at 3:14 AM, Antonio Nunes <email@hidden> wrote:
> On 5 Jun 2012, at 00:09, Stephen J. Butler wrote:
>
>> You can use extended attributes to attach information to a file. Maybe
>> serialize your session state as a plist and use setxattr/getxattr to
>> manipulate it. Follows the file as it's moved around.
>
> Thanks Stephen,
>
> I think the extended attributes are pretty persistent though, they'll follow the file around across to other computers, right? I wouldn't want that. I only need the data on the particular user's system. Starting to look like l'm probably better off devising my own scheme.
In general, yes. It won't follow if you upload to a website, say
Dropbox, and then someone else downloads it. But if you copy it to a
thumb drive and send it then it will.
One thing you could try is to mix the two ideas. Generate a GUID for
each file and store that in the extended attribute. Then use the GUID
to lookup your session information in an application CoreData store or
simple SQLite database.
Then only the GUID follows the file around, and on another machine it
won't have the session information and you can create it fresh. Also,
you'll have to handle the case when a file doesn't have a GUID in its
extended attributes and attach a new one.
_______________________________________________
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