Next: Components of Pathnames, Previous: Pathnames, Up: Pathnames [Contents][Index]
Pathname objects are usually created by parsing filenames (character strings) into component parts. MIT/GNU Scheme provides operations that convert filenames into pathnames and vice versa.
Returns a pathname that is the equivalent of object. Object
must be a pathname or a string. If object is a pathname, it is
returned. If object is a string, this procedure returns the
pathname that corresponds to the string; in this case it is equivalent
to (parse-namestring object #f #f)
.
(->pathname "foo") ⇒ #[pathname 65 "foo"] (->pathname "/usr/morris") ⇒ #[pathname 66 "/usr/morris"]
This turns thing into a pathname. Thing must be a pathname or a string. If thing is a pathname, it is returned. If thing is a string, this procedure returns the pathname that corresponds to the string, parsed according to the syntax of the file system specified by host.
This procedure does not do defaulting of pathname components.
The optional arguments are used to determine what syntax should be used
for parsing the string. In general this is only really useful if your
implementation of MIT/GNU Scheme supports more than one file system,
otherwise you would use ->pathname
. If given, host must be
a host object or #f
, and defaults must be a pathname.
Host specifies the syntax used to parse the string. If host
is not given or #f
, the host component from defaults is
used instead; if defaults is not given, the host component from
param:default-pathname-defaults
is used.
->namestring
returns a newly allocated string that is the
filename corresponding to pathname.
(->namestring (->pathname "/usr/morris/minor.van")) ⇒ "/usr/morris/minor.van"
Returns a pathname that locates the same file or directory as
pathname, but is in some sense simpler. Note that
pathname-simplify
might not always be able to simplify the
pathname, e.g. on unix with symbolic links the directory
/usr/morris/../ need not be the same as /usr/. In cases
of uncertainty the behavior is conservative, returning the original or a
partly simplified pathname.
(pathname-simplify "/usr/morris/../morris/dance") ⇒ #[pathname "/usr/morris/dance"]
Next: Components of Pathnames, Previous: Pathnames, Up: Pathnames [Contents][Index]