On May 28, 2012, at 5:51 PM, Graham Cox wrote:

> 
> On 28/05/2012, at 7:31 PM, Roland King wrote:
> 
>> The way I read it is you register the entitlement exactly as you have been 
>> doing, as a user entitlement to Library/<whatever>. Then at runtime you use 
>> getpwuid() to find an absolute path to the actual user's home directory, 
>> construct the Library/<whatever> on top of that as an absolute (and of 
>> course dynamic depending on the user) path and open the file there. If my 
>> understanding is correct, the generic user entitlement you added will give 
>> you access to that absolute path.
> 
> 
> That sounds fine, except that CFPreferencesCopyAppValue doesn't take a path, 
> just a bundle ID and key. I can't see an alternative API that takes a path - 
> are you saying I have to open the file and parse it myself? While that isn't 
> too hard, it seems to be going against the point of having an API for 
> preferences which isolate you from format changes and file system details and 
> so on.
> 
> --Graham
> 

Again I've not done this - just reading and attempting comprehension - but yes 
in this case that's what I think you have to do. The CFPreferencesCopyAppValue 
indirects through the file path mapper and goes to the local sandboxed version 
of ~/Library which doesn't have the preferences file in it. You could I suppose 
find the real one and copy it into the sandboxed location at the right place, 
then use the API to read it, that might work. Yes I know that would stink up 
the code somewhat and is not a long-term solution to the problem. 

I'm with you on having the API point being a much better way, Apple now has to 
decide whether or not allowing that kind of access is something they will 
sanction, then they'll fix the API point to allow it, or else they'll say no. I 
don't think there was a full understanding, until people started trying this 
stuff, how many applications on OSX do reach all over the filesystem looking at 
stuff and how many apps just won't sandbox whilst retaining full functionality. 
From my reading of the dev forums, and boy there are some frustrated people 
over there, they are still trying to come up with a way which works.

I'd have a go see if you can even make the path and access the file at all 
first, then we'll know if we have decoded the tech note properly. 


_______________________________________________

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