I have a NSOpenPanel and I get the URL for the file from it and put it into an NSString like this:
imageURL = [[[panel URLs] objectAtIndex: 0] absoluteString];
Then when I go to save the file (in the same location as the file was opened) I use this:
[imageData writeToFile:[NSString stringWithFormat:@"%@/%@.%@", imageURL, imageName, imageType] atomically:NO];
Problem with this is that it won't save to any location with a space in. For example is there was a folder in that path like this:
This Folder
It would be put in the string like this:
This%20Folder
But it of course can't save to that location because its not right. How can I get around this? Possible to get the actual string with no changes? Thanks.
try this,
imageURL = [imageURL stringByReplacingPercentEscapesUsingEncoding:NSAsciiStringEncoding]