The file system is an important part of any operating system, it’s where users keep their stuff. The organization of the file system plays an important role in helping the user find files. The organization also makes it easier for apps and the system itself to find and access the resources they need to support the user.

The file systems in Mac OS X and iOS are both based on the UNIX file system. All of the disks attached to the computer – whether they are physically plugged into the computer or are connected indirectly through the network – contribute space to create a single collection of files. Because the number of files can easily be many millions, the file system uses directories to create a hierarchical organization.

File Paths

The location of any file or folder on disk is specified by a hierarchical path. All paths start with the / character, followed by a list of subfolders, with each subfolder separated by the / character. For example, the path

/Users/tom/Documents/greatpicture.jpg

specifies that the file greatpicture.jpg is located in the folder Documents, which is located in the folder tom, which is located in the folder Users, which is located at the root level of the systems primary hard disk.

Secondary Disk Drives

If a file is not located on the primary hard disk, the path must begin with /Volumes/<drive name>. For example, the path

/Volumes/Archives/Images/sunset.jpg

specifies that the file sunset.jpg is located in the folder Images on the hard drive named Archives.

Paths Relative to the Home Folder

If a path begins with the ~ character, the path is relative to the current user’s home folder. For example, the path

~/Pictures/waterfall.jpg

specifies that the file waterfall.jpg is contained in the Pictures folder inside the current user’s folder. If the current user is named sam, the path above is equivalent to:

/Users/sam/Pictures/waterfall.jpg

Paths Relative to the Current Database

If a path doesn’t begin with the / or ~ characters, it is relative to the location of the current database. For example, the path

mylogo.gif

specifies that the file mylogo.gif is in the same folder as the current database. The path

artwork/signature.png

specifies that the file signature.png is located in the folder artwork, which is located in the same folder as the current database.

HFS Paths

For compatibility with older Panorama database, file paths can also be specified in HFS format. HFS stands for Hierarchical File System and is the format that was used in all versions of Mac OS prior to Mac OS X (Mac OS 9, 8, 7, etc.) HFS paths start with the drive name followed by a list of folders, all separated by colons. For example, the path:

Archives:Images:sunset.jpg

specifies that the file sunset.jpg is located in the folder Images on the hard drive named Archives. Note: When using HFS format the drive name is always required, even for the primary disk (except for database relative paths, as described in the next section).

HFS Paths Relative to the Current Database

If an HFS path starts with the : character, the path is relative to the current database. For example, the path

:artwork:signature.png

specifies that the file signature.png is located in the folder artwork, which is located in the same folder as the current database.

Note: If the first folder name is not the same as a drive name, the leading : can be omitted, like this:

artwork:signature.png

However, if there is a drive named artwork mounted on the system, this will be treated as a regular, non-relative path.

Mixed Paths

Panorama allows you to mix different / and : characters in a path. If the path begins with a drive name followed by a colon, it is treated as an HFS path and / characters are interpreted as colons. Otherwise it is treated as a standard path and : characters are interpreted as slashes. Here are some examples:

/Users/bob/Library/Preferences:AcmeSoft:Settings.plist
Macintosh HD:Users/sam/Documents/letter.doc

Folder IDs

In the HFS system that was used in all versions of Mac OS prior to Mac OS X (Mac OS 9, 8, 7, etc.), folders could be identified by Folder IDs, which were opaque 6 byte binary values that uniquely identified each folder. Previous versions of Panorama could convert a path into a Folder ID using the folder( function, and convert a Folder ID into a path with the folderpath( function, and also generated Folder IDs with functions like info(“panoramafolder”), dbfolder(, homesubfolder( and many others.

Unlike HFS, the Mac OS X file system (which is based on UNIX) does not use or support the concept of Folder IDs. All file locations are simply specified with paths, as described above. However, since so many Panorama functions and statements depend on Folder IDs, Panorama still supports their use. A path can be converted into a Folder ID with the folder( function. Folder IDs can also be created by functions that specify specific locations like info(“panoramafolder”), dbfolder(, homesubfolder( etc. A Folder ID can be converted into an HFS path with the folderpath( function.

Expert Tip: In previous versions of Panorama, since Folder IDs were opaque binary values they could not be created manually, only with special functions. In the current version of Panorama, Folder IDs are no longer opaque binary values. Instead, they are simply standard, fully qualified paths. Fully qualified means that the path must be absolute (starting with /) and contain the complete path of the folder. Note: A Folder ID must not end with the / character.)

Here are some examples of valid Folder IDs:

/Users/steve/Documents
/Volumes/BigFatDisk/Programming/Perl
/Users/mel/Movies/Baby

Here are examples of paths that are not valid Folder IDs:

BigFatDisk:Programming:Ruby ☞ HFS is not allowed
/Users/steve/Documents/  ☞ trailing / is not allowed 
artwork/logos  ☞ relative paths are not allowed

If you have any doubts, you can always use the folder( function to create the Folder ID for you. This function will convert any of the paths listed above into valid Folder ID paths. But if you format the path correctly, you can create a Folder ID with a simple assignment statement. The following two statements have the identical result:

myfolder = folder("BigFatDisk:Programming:Perl")

will create a Folder ID using the folder( function (the standard path format could also be used).

myfolder = "/Volumes/BigFatDisk/Programming/Perl"

will create a Folder ID directly.

Since a Folder ID is a valid path, you can use it anywhere a path is required, and you can manipulate Folder IDs using any of Panorama’s text tools. This program fragment checks to see if the Panorama application is installed in the Application folder.

if info("panoramafolder") beginswith "/Application"
    do something
endif

In previous versions of Panorama this wouldn’t have worked because the Folder ID did not contain text. Instead you would have had to convert to text using the folderpath( function, which of course will still work, but is significantly more complicated:

if folderpath(info("panoramafolder")) beginswith firstline(info(volumes")+":Application"
    do something
endif

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but with significant changes, including the ability to handle UNIX style file paths in addition to HFS and changes to the way Folder IDs are handled.