Re: Using pathnames with special characters
Re: Using pathnames with special characters
- Subject: Re: Using pathnames with special characters
- From: Chris Ridd <email@hidden>
- Date: Wed, 01 May 2002 11:03:39 +0100
Cedric John <email@hidden> wrote:
>
Hi!
>
>
I'm implementing a freeware that needs to send tasks to the OS using
>
pathnames as arguments. However, on difficulty that I encounter is that
>
Darwin will not recognize a pathname on the form "/folder/another folder/
>
some file name.whatever" since it contains special characters (blanks).
>
Since my freeware requires users to choose their own files, I would need
>
to make the system understand each and every possible pathname. The
>
browser has no problem dealing with them, and I am sure it is a trivial
>
issue, but I am stuck. Does anyone have a clue?
>
>
Thanks a lot in advance!
>
>
Cidric John
>
Ph.D. Student
Darwin certainly *does* handle spaces in pathnames. You're probably falling
foul of some layer unexpectedly interpreting the string you're giving it
being sensitive to spaces.
If you're using system() then the passed string is interpreted by sh, and
so you need to look at sh's quoting rules. (Hint: replace \ with \\,
replace " with \" and surround each argument with " characters.)
If you're using NSTask and +launchedTaskWithLaunchPath:arguments: then you
shouldn't need to worry about quoting (as arguments takes an NSArray.)
What calls are you using to start your subprocess?
Cheers,
Chris
_______________________________________________
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.