Re: "quoted form of" anomaly when pathname contains '
Re: "quoted form of" anomaly when pathname contains '
- Subject: Re: "quoted form of" anomaly when pathname contains '
- From: Neil Faiman <email@hidden>
- Date: Sat, 2 Apr 2005 11:40:50 -0500
I think that you may be being led astray by the rendering of quoted
strings as they are shown in the script editor value window.
If I run this script, to show me exactly what the rendering is:
every character of quoted form of POSIX path of
"Futura:Users:neil:Desktop:A Wife's Perspective:"
I get this:
{"'", "/", "U", "s", "e", "r", "s", "/", "n", "e", "i", "l", "/", "D",
"e", "s", "k", "t", "o", "p", "/", "A", " ", "W", "i", "f", "e", "'",
"\\", "'", "'", "s", " ", "P", "e", "r", "s", "p", "e", "c", "t", "i",
"v", "e", "/", "'"}
Recombining manually, I see
'/Users/neil/Desktop/A Wife'\''s Perspective/'
As you observed, the shell will parse this as three fragments: a quoted
string whose content is "/Users/neil/Desktop/A Wife"; a backslashed
single quote; and a quoted string whose content is "s Perspective". But
that's fine -- a single argument to the shell may be made up of
multiple fragments using different quoting conventions. The shell
parsing rule is something like this:
set the argument to the empty string
repeat
if the next character is a backslash then
discard it and append the character following it to the argument
else if the next character is a single quote then
parse a single-quoted string and append it to the argument
else if the next character is a double quote then
parse a double-quoted string and append it to the argument
else
append the next character to the argument
until the next character is a white-space character
And, sure enough, if I run this script:
do shell script "echo " & quoted form of POSIX path of
"Futura:Users:neil:Desktop:A Wife's Perspective:"
I get back
"/Users/neil/Desktop/A Wife's Perspective/"
which looks right.
Regards,
Neil Faiman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden