Re: Creating a folder on the desktop (recap)
Re: Creating a folder on the desktop (recap)
- Subject: Re: Creating a folder on the desktop (recap)
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 9 Sep 2005 00:31:16 -0400
On 9/8/05, patrick machielse <email@hidden> wrote:
> I further learned / found out that support for true UNIX file paths
> seems constricted to "System Events"
Could you expand on what you mean by that?
> and that POSIX path / file is
> not a complete peer, in that it can't resolve "~/.." etc.
In UNIX, tilde-expansion is purely the province of the shells (and
various other programs which emulate the shells' behavior). The
operating system interface does not treat tilde specially; for
instance, a C program that looks for "~/foo" is going to fail to find
it unless there's a subdirectory of the current working directory
named '~' with a file named 'foo' in it. If System Events supports
the tilde-notation on OS X, I find that surprising. Useful, but
surprising.
The only completely reliable way to get the name of the user's home
directory in UNIX is to call one of the getpwent() functions to look
the user up in the password database and retrieve the pw_dir field.
Generally, however, looking at the value of the environment variable
'HOME' - which is set to that field's value at login time - is
sufficient. The user can change the value of HOME, but presumably
they do so with intent (which can safely be honored; there's no
security issue, since changing HOME to a random directory doesn't
convey any access to that directory they don't have already, it just
lets them refer to it by a shorter pathname).
Hm. I'm guessing that while there are constructs in AS to get the
user's home directory etc, there's no way to read arbitrary
environment variables directly; you have to go through the shell with
something like (do shell script "echo \"$BLAH\"") ... is that true?
--
Mark J. Reed <email@hidden>
_______________________________________________
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