Merge pull request #11 from Tankanow/handle-missing-asset-roots

find-assets handles get-resource returning nil
This commit is contained in:
Dmitri Sotnikov 2015-01-11 14:27:13 -05:00
commit 25a625d4bc

View file

@ -22,11 +22,18 @@
matches (map #(re-find % name) ignored-files)] matches (map #(re-find % name) ignored-files)]
(not (some seq matches))))) (not (some seq matches)))))
(defn find-assets [f ext ignored-files] (defn find-assets
(->> (get-resource f) "Find all assets in the given root directory (f) and the given file
file-seq extension (ext) ignoring any files that match the given (ignored-files).
(filter (ignore ignored-files)) First make sure that the root directory exists, if yes: process as normal;
(filter (fn [file] (-> file .getName (.endsWith ext)))))) if no, return empty vector."
[f ext ignored-files]
(if-let [root (get-resource f)]
(->> (get-resource f)
file-seq
(filter (ignore ignored-files))
(filter (fn [file] (-> file .getName (.endsWith ext)))))
[]))
(defn create-folder [folder] (defn create-folder [folder]
(let [loc (io/file (str public folder))] (let [loc (io/file (str public folder))]