fs-utils

2017-08-30

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 :recursivep 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 .

Licensed under the MIT License.

A copy of the license is available here.

Author
Michael Fiano <michael.fiano@gmail.com>
Maintainer
Michael Fiano <michael.fiano@gmail.com>
License
MIT