Re: Quirk coercing aliases to strings SOLVED (Akua)
Re: Quirk coercing aliases to strings SOLVED (Akua)
- Subject: Re: Quirk coercing aliases to strings SOLVED (Akua)
- From: Brennan <email@hidden>
- Date: Fri, 31 Aug 2001 12:14:44 +0200
On 30/8/01 at 10:04 pm, email@hidden wrote:
>
Message: 3
>
Date: Fri, 31 Aug 2001 02:16:19 +0200
>
From: Brennan <email@hidden>
>
Subject: Quirk coercing aliases to strings
>
To: applescript-users <email@hidden>
>
>
I just discovered this:
>
>
>
set theFile to (choose file)
>
set n to "test"
>
set newPath to file ((theFile as string) & ":" & n)
>
>
>
Let's suppose you choose file "Macintosh HD:A Folder:A File"
>
The result of these three lines will be
>
>
"Macintosh HD:A Folder:test"
>
>
rather than
>
>
"Macintosh HD:A Folder:A File:test"
>
>
which is more what I would have expected. Actually, I would have expected an
>
error for treating 'A File' as a folder.
>
>
It looks as though the ":" is doing a 'level up' in the file structure, like
>
UNIX's ../
>
>
This can be confirmed by
>
>
set newPath to file ((theFile as string) & "::" & n)
>
>
Which will return
>
>
"Macintosh HD:test"
>
>
More colons will take you further, if you have further to go.
>
>
Can anyone explain this to me? I'm not complaining. I think it's very useful,
>
but I don't fully understand what's happening.
OK, it turns out that Akua Sweets is responsible for this weird behavior. I guessed as much, because I knew Akua has some alias<->string coercions.
When I remove Akua Sweets, I get an error about 'A File' being the wrong type, which is what I would have expected.
Good to know. It's very useful behavior, but I'm glad it can be turned on and off, as it were.
-Brennan