Re: How to get bookmarks data for non-existing files
Re: How to get bookmarks data for non-existing files
- Subject: Re: How to get bookmarks data for non-existing files
- From: John Joyce <email@hidden>
- Date: Thu, 09 Feb 2012 08:18:03 -0600
On Feb 9, 2012, at 7:06 AM, Gerriet M. Denkmann wrote:
>
> On 9 Feb 2012, at 10:33, Quincey Morris wrote:
>
>> On Feb 8, 2012, at 18:20 , Gerriet M. Denkmann wrote:
>>
>>> The only keys which seem to work for an non-existing file seem to be:
>>> NSURLNameKey
>>> NSURLIsDirectoryKey
>>> NSURLIsRegularFileKey
>>> NSURLIsSymbolicLinkKey
>>> NSURLIsVolumeKey
>>> (I did try many, though not all).
>>>
>>> There is more info in the bookmarkData: like full path (this would be much more useful than just the NSURLNameKey), NSFileSystemFileNumber (probably not very useful in this case) and others.
>>
>> I happened to notice this today:
>>
>> -[NSURL bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:]
>>
>> which suggests to me that the availability of keys depends on how the bookmark was created. If these are bookmarks you've created for yourself, then presumably you can add the information you will want if the target file is missing.
>
> No, these bookmarks are not created by me. They come from ~/Library/Preferences/com.apple.TextEdit.LSSharedFileList.plist.
>
> Here is the content of a typical bookmark (zero bytes replaced by @):
>
> Version → 0x10010000
> Path Array → /Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Agenda.rtf
> Nodes Array → 497483, 2, 27, 2064, 55998, 2995129, 3624409, 7153541
> 0x1010 → @@@@@@@@@@@@@@@@@@@@@@
> 0x2000 → 61440, 0, 1, 0, 0, 0, 0, 0, 0
> 0x2002 → /Volumes/เม่น
> 0x2010 → เม่น
> 0x2011 → 506E1F67-24E9-336E-89FC-8F6904D2FE79
> 0x2012 → 51539607552
> 0x2013 → 751533532737
> 0x2020 → @@@@@ï?@@@@@@@@@@@@
> 0xf080 → 3063f07b476c97a843db5b50742185c6499849c7;00000000;00000000;00000020;com.apple.app-sandbox.read-write;000000000e000004;00000000006d2785;@
>
> Any ideas what these keys might mean?
>
>
> Kind regards,
>
> Gerriet.
>
>
The plist you are talking about is TextEdit's Open Recent menu list.
It is just xml.
Open the plist file (or a copy) in Xcode and see how it is structured.
Then take a look at the source code for TextEdit.
It might be somewhat revealing to look up LSSharedFileList.h
From
https://developer.apple.com/library/mac/#releasenotes/Carbon/RN-LaunchServices/_index.html
The Shared File List API is new to Launch Services in Mac OS X Leopard. This API provides access to several kinds of system-global and per-user persistent lists of file system objects, such as recent documents and applications, favorites, and login items. For details, see the new interface file LSSharedFileList.h.
_______________________________________________
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