Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert NSString containing URL to POSIX path

Tags:

I'm working on retrieving a POSIX path to a folder or file from an NSPathControl after dropping the file or folder onto it.

I'm a beginner, but I was able to get the value from the control (called Destination) in my code this way:

NSString *filepath;
filepath = [Destination stringValue];

This gives me something like

file://test/My%20New%20Project/

but I'd like to have it in the POSIX path form:

/test/My New Project
because I need to pass it to a NSTask running a command-line program.

Any suggestion about how to convert the content of this NSString from an URL format to a POSIX path?