From 4ace15d5dbe5e9877438660a2abc79d48afc0403 Mon Sep 17 00:00:00 2001 From: lukas Date: Fri, 21 Feb 2020 11:08:14 +0100 Subject: [PATCH] adjust find-assets function Co-authored-by: Jan Krebs --- src/cryogen_core/new_io.clj | 9 ++++++--- test/cryogen_core/compiler_test.clj | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cryogen_core/new_io.clj b/src/cryogen_core/new_io.clj index 1553a60..4e6b80a 100644 --- a/src/cryogen_core/new_io.clj +++ b/src/cryogen_core/new_io.clj @@ -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; if no, return empty vector." [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-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 filter-file - filter-ext))) + filter-ext + (map get-java-path)))) ; ; diff --git a/test/cryogen_core/compiler_test.clj b/test/cryogen_core/compiler_test.clj index c59257a..0442b5f 100644 --- a/test/cryogen_core/compiler_test.clj +++ b/test/cryogen_core/compiler_test.clj @@ -68,7 +68,7 @@ and more content. (let [entries (check-fn mu)] (is (= 1 (count entries))) (is (= (.getAbsolutePath (File. (str dir File/separator file))) - (.toString (.toAbsolutePath (:java-path (first entries))))))) + (.getAbsolutePath (first entries))))) (reset-resources))))))) (defmacro with-markup [mu & body]