find-assets handles get-resource returning nilern
- this can/will happen if a user doesn't have a resource root directory, e.g. if the resources/templates/asc/posts directory doesn't exist.
This commit is contained in:
parent
cb18e5734d
commit
8ff3f19362
1 changed files with 12 additions and 5 deletions
|
@ -22,11 +22,18 @@
|
|||
matches (map #(re-find % name) ignored-files)]
|
||||
(not (some seq matches)))))
|
||||
|
||||
(defn find-assets [f ext ignored-files]
|
||||
(defn find-assets
|
||||
"Find all assets in the given root directory (f) and the given file
|
||||
extension (ext) ignoring any files that match the given (ignored-files).
|
||||
First make sure that the root directory exists, if yes: process as normal;
|
||||
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))))))
|
||||
(filter (fn [file] (-> file .getName (.endsWith ext)))))
|
||||
[]))
|
||||
|
||||
(defn create-folder [folder]
|
||||
(let [loc (io/file (str public folder))]
|
||||
|
|
Loading…
Reference in a new issue