Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / Identifying Files, Directories, and Volumes


Names and Pathnames

Volumes, directories, and files all have names. A volume name is any sequence of 1
to 27 characters, excluding colons (:), that is assigned to a volume. File and directory names consist of any sequence of 1 to 31 characters, excluding colons. You can use uppercase and lowercase letters in names, but the File Manager ignores case when comparing names. The File Manager does not, however, ignore diacritical marks when comparing names.

Note
Although it is legal to use any character other than the colon in file, directory, and volume names, you should avoid using nonprinting characters in such names, even for temporary files that do not appear on the desktop or in the Standard File Package dialog boxes. A program written in C interprets a null character (ASCII code $00) as the end of a name; as a result, embedding the null character in a filename is likely to cause problems. In addition, file, directory, or volume names with null characters are not usable by AFP file servers (such as computers running Macintosh File Sharing or AppleShare software). In general, you should ensure that you use only printing characters in names of objects that you create in the file system.
Files and directories located in the same directory must all have unique names. However, there is no requirement that volumes have unique names. It is perfectly acceptable for two mounted volumes to have the same name. This is one reason why your application should use volume reference numbers rather than volume names to specify volumes.

You can also specify files and directories using pathnames, although this method is discouraged. There are two kinds of pathnames, full and partial. A full pathname is a sequence of directory names, separated by colons, starting from the root directory (or volume) and leading down to the file. A full pathname to the file "Bananas," for instance, might be something like this:

MyVolume:Fruits:Tropical:Bananas
A partial pathname is a pathname that begins in some directory other than the root directory. A particular directory is specified by volume reference number (in the case of the root directory), working directory reference number, or directory ID, and the pathname begins relative to that directory. If the directory "Fruits" were specified, for instance, the partial pathname to the "Bananas" file would be

:Tropical:Bananas
The use of pathnames, however, is highly discouraged. If the user changes names or moves things around, they are worthless. It's best to stay with simple file or directory names and specify the directory containing the file or directory by its directory ID.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996