Re: NSWorkspace issue

2014-05-07 Thread Ken Thomases
On May 7, 2014, at 12:02 AM, Varun Chandramohan wrote:

NSURL *fileURL = [NSURL URLWithString:@/Users/usr/Desktop/libd.dylib];

This is not correct.  +[NSURL URLWithString:] expects a valid URL string.  What 
you're providing is a file path string, which is not a URL string.  A URL 
string might be http://www.apple.com; or 
file:///Users/usr/Desktop/libd.dylib.  However, never just prepend file:// 
to a file path to try to make it into a URL string.  That doesn't correctly 
handle a path which contains characters which are not valid in URLs.

The correct thing to do is use +[NSURL fileURLWithPath:] or a similar method.

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

Re: NSWorkspace issue

2014-05-07 Thread Varun Chandramohan
Ah yes, that was the mistake. I did not notice it. Probably its always a
good idea to use fileURLWithPath as I always deal with file urls and not
http://.


On 7/05/2014 3:58 pm, Ken Thomases k...@codeweavers.com wrote:

On May 7, 2014, at 12:02 AM, Varun Chandramohan wrote:

NSURL *fileURL = [NSURL
URLWithString:@/Users/usr/Desktop/libd.dylib];

This is not correct.  +[NSURL URLWithString:] expects a valid URL string.
 What you're providing is a file path string, which is not a URL string.
A URL string might be http://www.apple.com; or
file:///Users/usr/Desktop/libd.dylib.  However, never just prepend
file:// to a file path to try to make it into a URL string.  That
doesn't correctly handle a path which contains characters which are not
valid in URLs.

The correct thing to do is use +[NSURL fileURLWithPath:] or a similar
method.

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