Re: NSURL resourceValuesForKeys NSURLPathKey

2015-01-09 Thread Mike Abdullah

 On 9 Jan 2015, at 03:17, Sean McBride s...@rogue-research.com wrote:
 
 On Thu, 8 Jan 2015 16:31:18 -0800, Trygve Inda said:
 
 I call:
 
 NSData* bookmarkData = [url
 bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
 includingResourceValuesForKeys:nil
 relativeToURL:nil
 error:inError];
 
 And later:
 
 NSDictionary* dict = [NSURL resourceValuesForKeys:[NSArray
 arrayWithObject:NSURLPathKey] fromBookmarkData:[self bookmark]];
 if (dict)
 {
 path = [dict objectForKey:NSURLPathKey];
 }
 
 Path ends up with the correct value even though I passed nil above...
 
 When it resolves or fails to resolve?  Probably only the former.
 
 includingResourceValuesForKeys:nil
 
 Is this documented behavior?
 
 Dunno, but it reminds me of this:
 http://lists.apple.com/archives/cocoa-dev/2012/Oct/msg00299.html

That post is now a bit out of date: 
http://mikeabdullah.net/last-known-bookmark-location.html

 I think I should be putting NSURLPathKey in the call to create the bookmark,
 but it does seem to work without it. Thoughts?
 
 I would put it.


___

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

Re: NSURL resourceValuesForKeys NSURLPathKey

2015-01-08 Thread Sean McBride
On Thu, 8 Jan 2015 16:31:18 -0800, Trygve Inda said:

I call:

NSData* bookmarkData = [url
bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
includingResourceValuesForKeys:nil
relativeToURL:nil
error:inError];

And later:

NSDictionary* dict = [NSURL resourceValuesForKeys:[NSArray
arrayWithObject:NSURLPathKey] fromBookmarkData:[self bookmark]];
if (dict)
{
 path = [dict objectForKey:NSURLPathKey];
}

Path ends up with the correct value even though I passed nil above...

When it resolves or fails to resolve?  Probably only the former.

includingResourceValuesForKeys:nil

Is this documented behavior?

Dunno, but it reminds me of this:
http://lists.apple.com/archives/cocoa-dev/2012/Oct/msg00299.html

I think I should be putting NSURLPathKey in the call to create the bookmark,
but it does seem to work without it. Thoughts?

I would put it.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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

NSURL resourceValuesForKeys NSURLPathKey

2015-01-08 Thread Trygve Inda
I call:

NSData* bookmarkData = [url
bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
includingResourceValuesForKeys:nil
relativeToURL:nil
error:inError];

And later:

NSDictionary* dict = [NSURL resourceValuesForKeys:[NSArray
arrayWithObject:NSURLPathKey] fromBookmarkData:[self bookmark]];
if (dict)
{
 path = [dict objectForKey:NSURLPathKey];
}

Path ends up with the correct value even though I passed nil above...

includingResourceValuesForKeys:nil

Is this documented behavior?

I think I should be putting NSURLPathKey in the call to create the bookmark,
but it does seem to work without it. Thoughts?




___

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

Re: NSURL resourceValuesForKeys NSURLPathKey

2015-01-08 Thread Ken Thomases
On Jan 8, 2015, at 6:31 PM, Trygve Inda cocoa...@xericdesign.com wrote:

 I call:
 
 NSData* bookmarkData = [url
 bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
 includingResourceValuesForKeys:nil
 relativeToURL:nil
 error:inError];
 
 And later:
 
 NSDictionary* dict = [NSURL resourceValuesForKeys:[NSArray
 arrayWithObject:NSURLPathKey] fromBookmarkData:[self bookmark]];
 if (dict)
 {
 path = [dict objectForKey:NSURLPathKey];
 }
 
 Path ends up with the correct value even though I passed nil above...
 
 includingResourceValuesForKeys:nil
 
 Is this documented behavior?

To my mind, yes.  The docs for that method say In addition to the standard, 
system-defined resource properties, you can also request any custom properties 
that you provided when you created the bookmark.

What this means to me is that you can always request the standard, 
system-defined resource properties and expect to get a result.  In addition, 
you can request any custom properties that you provided when you created the 
bookmark.

Regards,
Ken


___

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