A pathname specifies the physical location of an object on a mounted volume. The File System Framework provides classes which enable you to specify pathnames in a portable manner, or in a host-specific way. You use pathnames to:
The classes associated with pathnames and pathname parsers are
You can obtain a file system entity by providing the pathname of the entity you want, and you can get the pathname of an entity by providing the file system entity itself. The file system gives you two ways to use pathnames with file system entities:
Host-specific paths are simple strings that store pathnames in the format used by a particular operating system. Some examples of host-specific pathnames are:
UNIX | /tmp/file.txt files/new/readme.txt |
---|---|
Windows and OS/2 | C:\temp\file.txt files\new\readme.txt |
Host-specific pathnames are not portable. For example, if you try to use a Windows-style pathname on a UNIX system, you will get an exception. The File System Framework provides a way to avoid this problem. All methods that take a host-specific path as a parameter also take an optional ICompoundNameParser parameter, which you can use to specify a parser for the pathname. If you do not explicitly specify a parser, you will get the parser that matches the path format of the host operating system:
The pathname parsers provided in this release of Open Class are
Although host-specific pathnames are easy to use, you sometimes need to store or manipulate a pathname in a portable manner. For example, a text document might need to include the relative path to an embedded graphic file. The class IPathName provides this portable functionality.
IPathName, derived from ICompoundName, represents full or partial paths to file system entities. It allows you to specify file system entities via their absolute or relative pathnames.
You can also construct an IPathName from a IDirectory instance and a partial path relative to that directory. The partial path can be specified either as an IHostPathName or as another IPathName.
Introduction to the File
System
Overview of File
System Entities
File System Exceptions
Instantiating
a File System Entity from a Host-Specific Pathname
Instantiating
a File System Entity from a Portable Pathname
Instantiating
Host-Specific Pathnames and Pathname Parsers
Instantiating
a Portable Pathname from a Host-Specific Pathname
Appending
and Retrieving Pathname Components