1 Introduction
2 Interface
3 Known Issues
4 History
5 Legal
Version: 1:0

path-misc: Misc. Path Utilities in Racket

Neil Van Dyke

 (require (planet neil/path-misc:1:0))

1 Introduction

The path-misc package provides some utilities for dealing with path objects.
The current version of this package has only two procedures.

2 Interface


(temp-directory)  path?

Like (find-system-path 'temp-dir), except, on Unix-like systems, "/tmp" is preferred over "/var/tmp" and "/usr/tmp".


(canonicalize-path path)  path?

  path : path-string?
Returns a canonical path to the same file or directory that path would reach. 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):


    |-- 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")

If a cycle is detected while following symbolic links, an exception is raised.

3 Known Issues

4 History

5 Legal

Copyright 2012 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.