GEOS SDK TechDocs
|
|
|
3 Disks and Drives
|
5 Files
Information, whether code or data, is always stored in files. However, storage volumes are not simply collections of files. Rather, they are organized into directories. There are two main reasons for this organization.
First, a large storage device can easily contain hundreds or thousands of files. Computer users need to be able to find a specific file quickly. If they were confronted with a list of all the files on a storage device, they would have a hard time finding the one they want. The directory structure solves this problem; users can navigate through the directory tree until they find the file they want.
The other reason for the directory structure is to expand the name-space for files. If every file on a volume were forced to have a unique name, users would find themselves severely restricted. Directories allow more flexibility; since a file is identified by both its name and its location, its name need only be unique within its directory.
A file can be uniquely specified by a full path . A full path specifies the volume containing the file as well as all the directories containing the file, starting with the root directory. The volume specification can usually be omitted, indicating that the file is on the same volume as the current working directory. Alternatively, the file can be specified with a relative path . A relative path specifies the file's position relative to the current working directory, instead of starting with the root.
In most implementations of DOS, there is a standard way of describing a path. These conventions are used in GEOS as well. A full path begins with a backslash, which represents the root directory. This may be followed by one or more directory specifications, separated by backslashes. The first directory listed would be a member of the root directory; each following directory would be a member of the preceding directory. A relative path is the same, except that it does not begin with a backslash. In either a full or a relative path, their are two special directory names. A single period (".") specifies the current directory; that is, the path "." indicates the current working directory, and the path "\GEOWORKS\DOCUMENT" is the same as the paths "\GEOWORKS\DOCUMENT\." and "\GEOWORKS\.\DOCUMENT". A double period ("..") indicates the parent of the current directory; thus, "\GEOWORKS\DOCUMENT\.." is equivalent to "\GEOWORKS".
The GEOS file management system allows each thread to have a working directory. Whenever a thread needs to open a file, it can rely on its working directory instead of passing a full path. GEOS provides an added mechanism: it defines certain system standard paths which can be reached with simple system commands. These paths provide a way to standardize directory usage; an application might, for example, keep a certain data file in the standard PRIVDATA directory, leaving the user to decide where that PRIVDATA directory may be. This is covered in detail in the following section.
Current Path and Directory Stack
Creating and Deleting Directories
GEOS SDK TechDocs
|
|
|
3 Disks and Drives
|
5 Files