Why does fileURLWithPath: give me a file://localhost/ URL?
- by jxpx777
I have a project I'm working on and this seems like the simplest thing in the world, but the +[NSURL fileURLWithPath:] factory method is returning a strange URL. I created an empty sample project to isolate the problem and in my app delegate's applicationDidFinishLaunching: method I have this simple code:
NSString *path = [@"~/Documents" stringByExpandingTildeInPath];
NSURL *url = [NSURL fileURLWithPath:path];
NSLog(@"%@ | %@", path, url);
and the NSLog result looks like this:
/Users/myusername/Documents | file://localhost/Users/myusername/Documents/
when I would expect the URL to be file:///Users/myusername/Documents.
Any thoughts on why this is behaving like this? (10.6.3 in case it matters.)