Re: [late reply] Re: Parameters for "path to" Command
Re: [late reply] Re: Parameters for "path to" Command
- Subject: Re: [late reply] Re: Parameters for "path to" Command
- From: Christopher Nebel <email@hidden>
- Date: Fri, 23 Aug 2002 20:30:19 -0700
On Friday, August 23, 2002, at 04:44 PM, Reinhold Penner wrote:
Why 'alias ":"' should produce a different place than 'file
specification ":"' is a mystery to me at the moment; I've filed a >> bug.
Oh, no. I knew it. Please don't fix this. It's not a bug, it's a
feature!!! It's so convenient. And it works and I don't have to ask
the Finder for container of path to me. Pretty please...
OK, let's get one thing straight. Two things, actually:
First: "path to me", because of peculiar implementation reasons, is
really the same thing as "path to", which is the same thing as "path to
current application", which is not necessarily the same thing as the
path to "me" (if that's even meaningful -- scripts don't have to reside
in files). But that's not the point here.
Second (and this *is* the point): file specification ":" (or alias ":",
or whatever you're actually using) producing the container of the
current application IS NOT A FEATURE. What ":" really means is the
current working directory. This *happens* to be the same thing as the
current application's container in most cases because (a) that's how
Mac OS traditionally sets it, and (b) most applications don't change
it. (There are a few exceptions to (b) like MPW.) If you treat ":" as
meaning the current application's container, YOU ARE RELYING ON A
COINCIDENCE. The working directory is *not* under AppleScript's
control, so there are limits to what AppleScript can do to keep it
working the way you're used to. If you want the path to the current
application, and you want to be sure of getting it, then you should USE
THE FUNCTION THAT WAS DESIGNED TO GIVE YOU THAT INFORMATION, i.e.,
"path to current application". If you detest talking to the Finder,
it's not that hard to tear the path apart manually to get the
container. If you're worried about the performance of "path to", then
you need to (a) measure the performance of your script and see if it's
actually an issue, and (b) if it is, don't call it so often. It's not
like the answer changes all the time.
Phew. Now then: I realize that lots of people rely on this behavior,
so I'll do what I can to keep it working. The bug in this case is that
'alias ":"' produces a very different result (the startup disk) than
'file specification ":"' (the current application's container) -- I'd
expect them to produce the same thing. Since one of them produces the
"right" result, we can try to modify the "wrong" case appropriately,
but we need to figure out what the heck is going on first.
--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.