adjust find-assets function

Co-authored-by: Jan Krebs <jan.krebs@student.uni-tuebingen.de>
This commit is contained in:
lukas 2020-02-21 11:08:14 +01:00
parent 87901a0e91
commit 4ace15d5db
2 changed files with 7 additions and 4 deletions

View file

@ -72,12 +72,15 @@ extension (ext) ignoring any files that match the given (ignored-files).
First make sure that the root directory exists, if yes: process as normal; First make sure that the root directory exists, if yes: process as normal;
if no, return empty vector." if no, return empty vector."
[base-path paths ext ignored-files] [base-path paths ext ignored-files]
(let [assets (cp-io/get-resources "" base-path paths) (let [assets (cp-io/get-resources "content" base-path paths)
filter-file (fn [xs] (filter #(= (:resource-type %) :file) xs)) filter-file (fn [xs] (filter #(= (:resource-type %) :file) xs))
filter-ext (fn [xs] (filter #(= (get-file-extension-from-resource %) ext) xs))] filter-ext (fn [xs] (filter #(= (get-file-extension-from-resource %) ext) xs))
cast-file (fn [java-path] (io/as-file (.toString java-path)))
get-java-path (fn [map-entry] (cast-file (:java-path map-entry)))]
(->> assets (->> assets
filter-file filter-file
filter-ext))) filter-ext
(map get-java-path))))
; ;
; ;

View file

@ -68,7 +68,7 @@ and more content.
(let [entries (check-fn mu)] (let [entries (check-fn mu)]
(is (= 1 (count entries))) (is (= 1 (count entries)))
(is (= (.getAbsolutePath (File. (str dir File/separator file))) (is (= (.getAbsolutePath (File. (str dir File/separator file)))
(.toString (.toAbsolutePath (:java-path (first entries))))))) (.getAbsolutePath (first entries)))))
(reset-resources))))))) (reset-resources)))))))
(defmacro with-markup [mu & body] (defmacro with-markup [mu & body]