organa.fs

Functions for interacting with files, paths, and directories in the
file system.

basename

(basename f)
Get file (not directory) portion of name of `f`, where `f` is a
`File` or path string.

dirfile

(dirfile f)
Find the directory File that contains File `f`, which must exist.

files-in-directory

(files-in-directory pathstr & {:keys [as], :or {as :file}})
Get list of (non-hidden) files in directory. Examples:

    (files-in-directory "/tmp")
    (files-in-directory "/tmp" :as :str)
    (files-in-directory "/tmp" :as :file)

path

(path & args)
Create a file or directory path (string) out of `args`.

    (path "/a" "b" "c.txt")
    ;;=>
    "a/b/c.txt"

splitext

(splitext f)
Split non-extension portion of file name from extension.

  (splitext "a") ;;=> '("a" nil)
  (splitext "a.b") ;;=> '("a" "b")
  (splitext "a.b.c") ;;=> '("a.b" "c")

with-tmp-dir

macro

(with-tmp-dir dir-file & body)
Create temporary file, bind to `dir-file`, and execute `body` in
that context, removing the directory afterwards.