AppleScript Programming/Aliases and paths

Paths can appear in the following format in AppleScript which is a carryover from Classic Mac OS. This type of path name is called HFS which is short for "Hierarchical File System".

::...::

For example, the following is an example an HFS path name Macintosh HD:Applications:Safari.app

HFS paths are different than the current OS X standard, called POSIX paths. The POSIX style comes from OS X's Unix heritage. Notice that in HFS path names, a colon ":", is used as a separator, and in POSIX path names, a forward slash "/" is used as a separator. The other major difference is that in HFS path names, the path name begins with the name of the volume and in POSIX path names, the startup volume doesn't need to be named, only other volumes need to be named.

Because of the history of OS X with both a Classic Mac OS history and a Unix history both HFS paths and POSIX paths are still useful and in AppleScript you sometimes have to convert from one standard to the other, depending upon which kind of path name is needed.

The following example of a POSIX path specifies the application Safari.app which is contained by the Applications folder on the start up disk.

/Applications/Safari.app

Converting between formats
Assuming oldPath would be an alias or record of a finder item, use the following command to set a standard Applescript alias to a POSIX path:

To convert a POSIX path to a standard Applescript alias (the inverse of the above command), use this command: