Re: [OSX]path to modem scripts folder
Re: [OSX]path to modem scripts folder
- Subject: Re: [OSX]path to modem scripts folder
- From: Chris Nebel <email@hidden>
- Date: Thu, 12 Jul 2001 11:25:45 -0700
- Organization: Apple Computer, Inc.
Shane Stanley wrote:
>
> The AppleScript phrase "path to modem scripts folder", if executed by a
>
>
> user, returns "That folder doesn't exist and you don't have permission
>
> to create it." (blunt isn't it? <grin>)
>
>
>
> If logged in as root, executing this line in script editor creates a
>
> folder called "Modem Scripts", at /System/Library, and returns
>
> "Macintosh HD:System:Library:Modem Scripts:" ignoring the default
>
modem
>
> scrips folder at "Macintosh HD:Library:Modem Scripts:" where all the
>
> factory installed ones go. I suggested to Mac OS X feedback that the
>
> call be implemented to return the globally availabe folder at
>
> /Library/Modem Scripts, and an additional item be added for "User Modem
>
>
> Scripts folder" to return ~/Library/Modem Scripts/ if that is
>
necessary,
>
> though I don't see why it should be. As I understand it, the
>
> /System/Library/Modem Scripts/ should not be accessed by user level
>
> apps anyway, so there is no need to add a reference to it for
>
> AppleScript.
As a couple of people have pointed out, the short answer to this question
is "use the 'from domain' parameter." That's fine as far as it goes, but
doesn't explain the larger question of what domains mean and how to use
them.
In classic Mac OS, there's only one folder for an interesting place, in
this case Modem Scripts. In Mac OS X, there are as many as four folders,
one for each "domain": system, local, network, and user. This lets you
(and Apple) do interesting things when installing. For example, all your
custom stuff stays separate from all the system-installed stuff, so you can
wipe the entire system folder and reinstall it without losing any of your
stuff. In a multi-user environment, you can decide whether something is
just for you, for everyone on the machine, or for everyone on your local
network.
What does this mean to you as a scripter? It means that if you want to
install something, you have to decide which domain to put it in. Only
Apple is supposed to change the system domain, so your choices are user,
local, or network. User is usually best (it's guaranteed writable), but if
you're feeling generous, offer the user a choice.
It also means that if you want to find all the stuff of a particular type
-- all the modem scripts, say -- you ought to scan the modem scripts
folders of all four domains and build a combined list. Half the point of
domains is that stuff in any of them is treated equally. (It's not that
stuff in /System shouldn't be accessed by user apps, it just shouldn't be
changed. In the case of conflicts -- for example, there's a ZippyCraft
modem script in both local and user -- user overrides local overrides
network overrides system.)
If you don't explicitly state a domain for "path to", it will use what it
considers appropriate for the selector. In most cases, this is the system
domain, but there are exceptions: for example, "path to the preferences
folder" gets you the user preferences folder. The fact that "modem
scripts" defaults to the system domain might be considered a bug, but given
that you're supposed to scan all four anyway, I sort of doubt it.
Nonetheless, I'll pass it along -- thanks for the feedback.
--Chris Nebel
AppleScript Engineering