(:require [clojure.java.io :as io])
(defn get-file-names [directory-object files-path]
(let [full-directory-path (.getPath directory-object)
get-js-file-path (fn [file]
(str files-path (.getName file)))]
(->> full-directory-path
io/file
file-seq
(filterv (fn [file] (.isFile file)))
(mapv get-js-file-path))))
(defn get-js-file-names []
(let [directory-object (io/resource "js")
directory-exists? (-> directory-object nil? not)]
(when directory-exists?
(get-file-names directory-object "/js/"))))
(get-js-file-names) ;; -> [<filename-1> ... <filename-n>]
Last active
November 23, 2019 16:07
-
-
Save ivermac/db2b4c6b669d153bddc852134c6c4675 to your computer and use it in GitHub Desktop.
Using Clojure to retrieve javascript file names in resources directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment