You are looking at historical revision 4518 of this page. It may differ significantly from its current revision.
- FSPath - CommonLISP style Namestring and Pathname Object
- Version History
FSPath - CommonLISP style Namestring and Pathname Object
FSPath is an extension of unit utils pathname concept. The extended pathname is referred to as a namestring. The CL pathname object analog is the fspath record object.
Four styles of namestring are supported:
- Universal Resource Identifier
- Universal Naming Convention, platform specific
- Filename, platform specific
- Filesystem Specific (Unimplemented)
These namestring forms are mapped into fspath components:
- URI scheme, Filesystem type
- Hostname, IP address, Domain name
- Drive, Port, Volume, Device
- Directory, split into a list by directory separator
- Version, usually a number (Faked for Unix and Windows)
The fspath record is to be a logical pathname, portable across platforms. A fspath created on Windows will be converted to the corresponding namestring on Unix.
Any missing component is represented by #f.
A SRFI-10 reader and printer are supplied.
This form is the same across platforms. This is not a "real" URI, it is unencoded.
This form is filesystem specific.
[procedure] (fspath? OBJECT)
Is the OBJECT an fspath object?
[procedure] (make-fspath [#:protocol] [#:host] [#:device] [#:directory] [#:file] [#:type] [#:version])
Returns a new fspath object. Default for all keyword parameters is #f.
When protocol is specified then a URI is assumed, unless filesystem specific. When directory is a string it is split into a list.
#:wide? specifies if the wide-character prefix '\\?\' is to be used. While the prefix is recognized there is currently no support for the Windows "wide" API.
#:unc? specifies if the unc form is to be used; '//<host>' & not '<host>:'.
[procedure] (namestring->fspath NAMESTRING)
Returns a new fspath object from the NAMESTRING.
[procedure] (fspath->namestring FSPATH)
Returns a new NAMESTRING from the FSPATH object.
[procedure] (fspath-* FSPATH)
Gets the specified component of the FSPATH object.
[procedure] (fspath-*-set! FSPATH VALUE)
Sets the specified component of the FSPATH object to VALUE.
[procedure] (fspath-class-name FSPATH)
Returns the kind of FSPATH. Currently one of uri, windows, or unix.
[procedure] (fspath-wide? FSPATH) [procedure] (fspath-wide-set! FSPATH FLAG)
[procedure] (fspath-unc? FSPATH) [procedure] (fspath-unc-set! FSPATH FLAG)
Copyright (c) 2007 Kon Lovett
- Initial release