1. Module (chicken pathname)
    1. absolute-pathname?
    2. decompose-pathname
    3. make-pathname
    4. make-absolute-pathname
    5. pathname-directory
    6. pathname-file
    7. pathname-extension
    8. pathname-replace-directory
    9. pathname-replace-file
    10. pathname-replace-extension
    11. pathname-strip-directory
    12. pathname-strip-extension
    13. normalize-pathname
    14. directory-null?
    15. decompose-directory
    16. Windows specific notes

Module (chicken pathname)

This module provides procedures for manipulating paths. If you want to operate on the files and directories which the paths represent, see Module (chicken file).


[procedure] (absolute-pathname? PATHNAME)

Returns #t if the string PATHNAME names an absolute pathname, and returns #f otherwise.


[procedure] (decompose-pathname PATHNAME)

Returns three values: the directory-, filename- and extension-components of the file named by the string PATHNAME. For any component that is not contained in PATHNAME, #f is returned.



[procedure] (make-pathname DIRECTORY FILENAME [EXTENSION])
[procedure] (make-absolute-pathname DIRECTORY FILENAME [EXTENSION])

Returns a string that names the file with the components DIRECTORY, FILENAME and (optionally) EXTENSION with SEPARATOR being the directory separation indicator (usually / on UNIX systems and \ on Windows, defaulting to whatever platform this is running on). DIRECTORY can be #f (meaning no directory component), a string or a list of strings. FILENAME and EXTENSION should be strings or #f. make-absolute-pathname returns always an absolute pathname.




[procedure] (pathname-directory PATHNAME)
[procedure] (pathname-file PATHNAME)
[procedure] (pathname-extension PATHNAME)

Accessors for the components of PATHNAME. If the pathname does not contain the accessed component, then #f is returned.




[procedure] (pathname-replace-directory PATHNAME DIRECTORY)
[procedure] (pathname-replace-file PATHNAME FILENAME)
[procedure] (pathname-replace-extension PATHNAME EXTENSION)

Return a new pathname with the specified component of PATHNAME replaced by a new value.



[procedure] (pathname-strip-directory PATHNAME)
[procedure] (pathname-strip-extension PATHNAME)

Return a new pathname with the specified component of PATHNAME stripped.


[procedure] (normalize-pathname PATHNAME [PLATFORM])

Performs a simple "normalization" on the PATHNAME, suitably for PLATFORM, which should be one of the symbols windows or unix and defaults to on whatever platform is currently in use. All relative path elements and duplicate separators are processed and removed. If NAME ends with a / or is empty, the appropriate slash is appended to the tail.

No directories or files are actually tested for existence; this procedure only canonicalises path syntax.


[procedure] (directory-null? DIRECTORY)

Does the DIRECTORY consist only of path separators and the period?

DIRECTORY may be a string or a list of strings.


[procedure] (decompose-directory DIRECTORY)

Returns 3 values: the base-origin, base-directory, and the directory-elements for the DIRECTORY.

a string or #f. The drive, if any.
a string or #f. A directory-separator when DIRECTORY is an absolute-pathname.
a list-of string or #f. The non-directory-separator bits.

DIRECTORY is a string.

Windows specific notes

Use of UTF8 encoded strings for pathnames is not supported. Windows uses a 16-bit UNICODE encoding with special system calls for wide-character support. Only single-byte string encoding can be used.

Previous: Module (chicken module)

Next: Module (chicken platform)