Make a little file loader
This commit is contained in:
parent
96ef8f098f
commit
d8d1bf0858
|
@ -3,7 +3,8 @@
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||||
:url "https://www.eclipse.org/legal/epl-2.0/"}
|
:url "https://www.eclipse.org/legal/epl-2.0/"}
|
||||||
:dependencies [[org.clojure/clojure "1.11.1"]]
|
:dependencies [[org.clojure/clojure "1.11.1"]
|
||||||
|
[babashka/fs "0.1.6"]]
|
||||||
:plugins [[lein-cljfmt "0.8.0"]]
|
:plugins [[lein-cljfmt "0.8.0"]]
|
||||||
:repl-options {:init-ns ludus.core}
|
:repl-options {:init-ns ludus.core}
|
||||||
:main ludus.core
|
:main ludus.core
|
||||||
|
|
12
src/ludus/loader.clj
Normal file
12
src/ludus/loader.clj
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
(ns ludus.loader
|
||||||
|
(:require [babashka.fs :as fs]))
|
||||||
|
|
||||||
|
(defn cwd [] (fs/cwd))
|
||||||
|
|
||||||
|
(defn load-import
|
||||||
|
([file] (-> file (fs/canonicalize) (fs/file) (slurp)))
|
||||||
|
([file from]
|
||||||
|
(load-import
|
||||||
|
(fs/path
|
||||||
|
(fs/parent (fs/canonicalize from))
|
||||||
|
(fs/path file)))))
|
Loading…
Reference in New Issue
Block a user