
CHAPTER 3: File System Access Using File and Folder objects 41
The home directory
A path name can start with a tilde (~) to indicate the user’s home directory. It corresponds to the platform’s
HOME environment variable.
UNIX and Mac OS assign the
HOME environment variable according to the user login. On Mac OS, the
default home directory is
/Users/username. In UNIX, it is typically /home/username or /users/username.
ExtendScript assigns the home directory value directly from the platform value.
On Windows, the
HOME environment variable is optional. If it is assigned, its value must be a Windows path
name or a path name referring to a remote server (such as
\\myhost\mydir). If the HOME environment
variable is undefined, the ExtendScript default is the user’s home directory, usually the
C:\Documents and
Settings\username
folder.
N
OTE: A script can access many of the folders that are specified with platform-specific variables through
static, globally available
Folder class properties; for instance, appData contains the folder that stores
application data for all users.
Volume and drive names
A volume or drive name can be the first part of an absolute path in URI notation. The values are interpreted
according to the platform.
Mac OS volumes
When Mac OS X starts, the startup volume is the root directory of the file system. All other volumes,
including remote volumes, are part of the
/Volumes directory. The File and Folder objects use these
rules to interpret the first element of a path name:
X If the name is the name of the startup volume, discard it.
X If the name is a volume name, prepend /Volumes.
X Otherwise, leave the path as is.
Mac OS 9 is not supported as an operating system, but the use of the colon as a path separator is still
supported and corresponds to URI and to Mac OS X paths as shown in the following table. These examples
assume that the startup volume is
MacOSX, and that there is a mounted volume Remote.
Windows drives
On Windows, volume names correspond to drive letters. The URI path
/c/temp/file normally translates
to the Windows path
C:\temp\file.
If a drive exists with a name matching the first part of the path, that part is always interpreted as that drive.
It is possible for there to be a folder in the root that has the same name as the drive; imagine, for example,
URI path name Mac OS 9 path name Mac OS X path name
/MacOSX/dir/file MacOSX:dir:file /dir/file
/Remote/dir/file Remote:dir:file /Volumes/Remote/dir/file
/root/dir/file Root:dir:file /root/dir/file
~/dir/file /Users/jdoe/dir/file
Kommentare zu diesen Handbüchern