1:0
canonicalize-path: Filesystem Path Canonicalization
Link to this document with
@other-doc['(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this document with
@other-doc['(lib "canonicalize-path/canonicalize-path.scrbl")]
1 Introduction
Link to this section with
@secref["Introduction"
#:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this section with
@secref["Introduction"
#:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
This package provides the canonicalize-path procedure, which takes a filesystem path and determines a
“canonical” equivalent. The canonical path is cleansed, simplified,
case-normalized, and complete, and all symbolic links have been followed.
For example, say that you have a Unix filesystem directory
structure like (where “->” denotes a symbolic link):
/tmp/ |
|-- a/ |
| |-- b1/ |
| | `-- s -> ../b2/c/f |
| `-- b2/ |
| `-- c/ |
| `-- f |
`-- x/ |
`-- y -> ../a |
If your current directory is then "/tmp/x", you get the following behavior:
> (canonicalize-path "y/b1/s")
#<path:/tmp/a/b2/c/f>
This is mostly intended for Unix-like filesystems, like
on GNU/Linux.
This code was originally written for the RackOut appliance.
2 Interface
Link to this section with
@secref["Interface" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this section with
@secref["Interface" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
(canonicalize-path path) → path?
|
path : path-string? |
Returns a “canonicalized” path to the same file or directory that path would reach. If a cycle is detected while following symbolic
links, an exception is raised.
3 Known Issues
Link to this section with
@secref["Known_Issues"
#:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this section with
@secref["Known_Issues"
#:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
4 History
Link to this section with
@secref["History" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this section with
@secref["History" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
5 Legal
Link to this section with
@secref["Legal" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Link to this section with
@secref["Legal" #:doc '(lib "canonicalize-path/canonicalize-path.scrbl")]
Copyright 2012, 2016 Neil Van Dyke. This program is Free Software; you can
redistribute it and/or modify it under the terms of the GNU Lesser General
Public License as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version. This program is
distributed in the hope that it will be useful, but without any warranty;
without even the implied warranty of merchantability or fitness for a
particular purpose. See http://www.gnu.org/licenses/ for details. For other
licenses and consulting, please contact the author.