Re: Convert path format?
Re: Convert path format?
- Subject: Re: Convert path format?
- From: John Stiles <email@hidden>
- Date: Fri, 10 Nov 2006 10:28:19 -0800
Sadly, both of these techniques are incorrect.
fileSystemRepresentation does not do any escaping.
Even more sadly, I do not know of a general-purpose way to do this
easily.
Actually, I can think of a way, but it's pretty bad—get the
fileSystemRepresentation, then for every character that is not a
forward slash, just convert it to its three-digit octal equivalent
("\123"). You could exclude known OK characters like letters and
numbers if you want the string to semi-legible for human beings.
Escaping strings and making them look pretty is non-trivial... if a
human being will not see it, though, who needs it to look pretty...?
On Nov 10, 2006, at 7:09 AM, leenoori wrote:
That's very bad advice. Use the fileSystemRepresentation method of
the NSString class, or the similar method in NSFileManager,
fileSystemRepresentationWithPath:.
El 10/11/2006, a las 15:44, Gonzalo Castro escribió:
Try this;
[[myStr componentsSeparatedByString:@" "]
componentsJoinedByString:@"\\ "]
Gonzalo
On 11/10/06 9:27 AM, "email@hidden"
<email@hidden> wrote:
------------------------------
Message: 7
Date: Fri, 10 Nov 2006 09:00:56 +0000
From: Trygve Inda <email@hidden>
Subject: Convert path format?
To: Cocoa-Dev Apple <email@hidden>
Message-ID: <C179F048.46C09%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
How can I convert the path returned by NSBundle bundlePath:
/Volumes/HD/Proj 2.0 \u00b5/Gen.app/Contents/Resources/someFile
To something that will work in terminal:
/Volumes/HD/Proj\ 2.0\ \302\265/Gen.app/Contents/Resources/someFile
Thanks,
Trygve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden