Go to the previous, next section.

Miscellaneous Pathname Procedures

This section gives some standard operations on host objects, and some procedures that return some useful pathnames.

variable+: local-host

This variable has as its value the host object that describes the local host's file system.

procedure+: host? object

Returns #t if object is a pathname host; otherwise returns #f.

procedure+: host=? host1 host2

Returns #t if host1 and host2 denote the same pathname host; otherwise returns #f.

procedure+: init-file-pathname [host]

Returns a pathname for the user's initialization file on host. The host argument defaults to the value of local-host. If the initialization file does not exist this procedure returns #f.

Under unix, the init file is called `.scheme.init'; under Windows and OS/2, the init file is called `scheme.ini'. In either case, it is located in the user's home directory, which is computed by user-homedir-pathname.

procedure+: user-homedir-pathname [host]

Returns a pathname for the user's "home directory" on host. The host argument defaults to the value of local-host. The concept of a "home directory" is itself somewhat implementation-dependent, but it should be the place where the user keeps personal files, such as initialization files and mail.

Under unix, the user's home directory is specified by the HOME environment variable. If this variable is undefined, the user name is computed using the getlogin system call, or if that fails, the geteuid system call. The resulting user name is passed to the getpwnam system call to obtain the home directory.

Under OS/2, the user's home directory is specified by the HOME environment variable. If this variable is undefined, but the USERDIR and USER environment variables are defined, then the user's home directory is `%USERDIR%\%USER%'. If only USERDIR is defined, then the user's home directory is `%USERDIR%\nouser'. If none of these variables is defined, then the home directory is the root directory of the current drive.

Under Windows, the user's home directory is computed by examining several environment variables, in the following order. If HOMEPATH is defined, the home directory is `%HOMEDRIVE%%HOMEPATH%'. If HOME is defined, the home directory is `%HOMEDRIVE%%HOME%'. If USERDIR and USERNAME are defined, the home directory is `%USERDIR%\%USERNAME%'. If USERDIR and USER are defined, the home directory is `%USERDIR%\%USER%'. If USERDIR is defined, the home directory is `%USERDIR%\nouser'. If none of these variables is defined, then the home directory is the root directory of the current drive.

procedure+: system-library-pathname pathname

Locates pathname in MIT Scheme's system library directory. An error of type condition-type:file-operation-error is signalled if pathname cannot be located on the library search path.

(system-library-pathname "compiler.com")
     => #[pathname 45 "/usr/local/lib/mit-scheme/compiler.com"]

procedure+: system-library-directory-pathname pathname

Locates the pathname of a MIT Scheme system library directory. An error of type condition-type:file-operation-error is signalled if pathname cannot be located on the library search path.

(system-library-directory-pathname "options")
     => #[pathname 44 "/usr/local/lib/mit-scheme/options/"]

Go to the previous, next section.