Re: Get HFS Path of POSIX Path?
Re: Get HFS Path of POSIX Path?
- Subject: Re: Get HFS Path of POSIX Path?
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 24 Sep 2004 08:36:23 -0700
On 9/24/04 8:14 AM, "Emmanuel" <email@hidden> wrote:
> At 7:21 AM -0700 24/09/04, Paul Berkowitz wrote:
>> POSIX file "/Users/Library/Folder/Object"
>>
>> will compile to
>>
>> file "Disk:Users:Library:Folder:Object"
>
> It's very minor and I may be wrong here but I think you may be bitten
> some day if you don't use the coercion in its standard syntax:
>
> "/Users/Library/Folder/Object" as POSIX file
I know you believe that Emmanuel - I've seen you use only that version - but
I believe you're in fact wrong. See the document pointed to by Steven:
TN2065: do shell script in AppleScript
<http://developer.apple.com/technotes/tn2002/tn2065.html>
About 2/3rds of the way down:
" To go the other way say your shell command returns a POSIX path as a
result use the POSIX file object. POSIX file with a path name evaluates to
a normal file object that you can then pass to other AppleScript commands.
For example:
set p to do shell script "echo ~"
POSIX file p
-- result: file "HD:Users:me:"
"
POSIX file p - not 'p as POSIX file' - seems to be canonical.
I believe you picked up your
"Disk:Folder:File" as alias
as opposed to
alias "Disk:Folder:File"
locution back in a particular version or versions of AS where
alias pathVariable
errored but
pathVariable as alias
worked. I think that was a temporary bug with a good workaround, but in in
any case it applied only to variables and not to hard-coded paths. No? And I
don't think it ever applied to POSIX file in any case.
--
Paul Berkowitz
_______________________________________________
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