Game Engine Architecture

(Ben Green) #1

264 6. Resources and the File System


reserved escape character. For example, fi le and directory names may
contain spaces under Windows, but such a path must be surrounded by
double quotes in certain contexts.
z Both UNIX and Windows have the concept of a current working directory
or CWD (also known as the present working directory or PWD). The CWD
can be set from a command shell via the cd (change directory) command
on both operating systems, and it can be queried by typing cd with
no arguments under Windows or by executing the pwd command on
UNIX. Under UNIX there is only one CWD. Under Windows, each vol-
ume has its own private CWD.
z Operating systems that support multiple volumes, like Windows, also
have the concept of a current working volume. From a Windows com-
mand shell, the current volume can be set by entering its drive lett er and
a colon followed by the Enter key (e.g., C:<Enter>).
z Consoles oft en also employ a set of predefi ned path prefi xes to repre-
sent multiple volumes. For example, PLAYSTATION 3 uses the prefi x
/dev_bdvd/ to refer to the Bluray disk drive, while /dev_hddx/ refers
to one or more hard disks (where x is the index of the device). On a PS3
development kit, /app_home/ maps to a user-defi ned path on whatever
host machine is being used for development. During development, the
game usually reads its assets from /app_home/ rather than from the
Bluray or the hard disk.

6.1.1.2. Absolute and Relative Paths

All paths are specifi ed relative to some location within the fi le system. When a
path is specifi ed relative to the root directory, we call it an absolute path. When
it is relative to some other directory in the fi le system hierarchy, we call it a
relative pa th.
Under both UNIX and Windows, absolute paths start with a path sepa-
rator character (/ or \), while relative paths have no leading path separator.
On Windows, both absolute and relative paths may have an optional volume
specifi er—if the volume is omitt ed, then the path is assumed to refer to the
current working volume.
The following paths are all absolute:

Windows
z C:\Windows\System32
z D:\ (root directory on the D: volume)
z \ (root directory on the current working volume)
Free download pdf