Re: Escaping spaces in paths
Re: Escaping spaces in paths
- Subject: Re: Escaping spaces in paths
- From: Ondra Cada <email@hidden>
- Date: Sun, 23 Jun 2002 15:06:54 +0200
On Sunday, June 23, 2002, at 03:35 , Jose L. Hales-Garcia wrote:
what for? Cocoa does not need it at all. Shells or URLs, though, need
more elaborate methods.
I am running a UNIX executable bundled in the main application bundle,
and,
of course the executable breaks if any directory element along its path
has
spaces in it.
This is the case of "more elaborate method needed". Spaces are -- by
far -- not the only elements shell interprets a special way: there are
also $'s, !'s, \'s, <'s, >'s, |'s, and much more. Do check the
documentation of the particular shell you are using; IIRC, there are some
differences between different shells in the special characters list.
So far as I remember *without* checking docs, you might be safe using
apostrophes to quote the whole string, *plus* quote exclamation marks and
quotes themselves. But do check docs anyway -- it's quite possible I
forgot something!
So I have to do something about it. What is the Cocoa class
used for substituting elements of NSString?
Strangely enough, NSString ;)
Unless the string is really long, the most convenient way would be
something on lines of
s=[[s componentsSeparatedByString:@"!"] componentsJoinedByString:@"\\!"]
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.