Steven
Steven

Reputation: 13975

Trying to get absolute Url from string?

I have the following url as a string

/Users/username/Documents/

and I need to convert it to

file:///localhost/Users/username/Documents/

So I can use it as a path argument in an NSOpenPanel. But I can't figure out how to do it? Is there any method? I know how to go from absolute -> normal, but not the other way around.

Upvotes: 0

Views: 175

Answers (1)

Hamed Saadat
Hamed Saadat

Reputation: 429

You need fileURLWithPath like this:

[NSURL fileURLWithPath:@"/Users/username/Documents/"];

Upvotes: 5

Related Questions