Utilities for working with files and file paths.
Common Lisp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
LICENSE
README.md
fs-utils.asd

README.md

fs-utils

Utilities for working with files and file paths.

Overview

This provides a means to access and read files relative to a project. It is useful for loading assets required within a project, and behaves correctly when distributing the project in the form of a dumped lisp image.

Install

(ql:quickload :fs-utils)

Usage

Get the path to a directory or file, relative to the project root directory.

(path :some-system "path/to/some/file")

:SOME-SYSTEM is the name of the project's ASDF system. Note that the file is optional if you just want the absolute path to a directory including the trailing slash character.

Read a file:

(read-file "resources/some-resource.lisp")

This will read the first s-expression located at "resources/some-resource.lisp", relative to the project root directory. It will not evaluate anything.

Map over a directory's files, performing an effect for all files that match a particular filter:

(map-files "path/to/dir" #'effect :filter #'filter :recursive t)

This will recursively iterate over every file in the given directory, running the function EFFECT on each if and only if the function FILTER returns T. Both EFFECT and FILTER must be defined to take one required argument - the path to the current file.

License

Copyright © 2015 Michael Fiano michael.fiano@gmail.com.

Licensed under the MIT License.

A copy of the license is available here.