cast path to file + fs-prefix default

This commit is contained in:
lukas 2020-02-26 08:49:46 +01:00
parent 2a3db17002
commit ba678e848f
3 changed files with 4 additions and 5 deletions

View file

@ -128,7 +128,7 @@
ignore-patterns ;:- s/Str ignore-patterns ;:- s/Str
] ]
(let [resources (sort this/compare-resource (get-resources fs-prefix base-path source-paths)) (let [resources (sort this/compare-resource (get-resources fs-prefix base-path source-paths))
resources (filter-resources-for-ignore-patterns ignore-patterns resources) ] resources (filter-resources-for-ignore-patterns ignore-patterns resources)]
(if (empty? resources) (if (empty? resources)
(throw (IllegalArgumentException. (str "resource " base-path ", " (throw (IllegalArgumentException. (str "resource " base-path ", "
source-paths " not found"))) source-paths " not found")))

View file

@ -466,7 +466,7 @@
new-io/get-resource new-io/get-resource
slurp slurp
read-string read-string
(update-in [:fs-prefix] (fnil str "")) (update-in [:fs-prefix] (fnil str "content"))
(update-in [:blog-prefix] (fnil str "")) (update-in [:blog-prefix] (fnil str ""))
(update-in [:page-root] (fnil str "")) (update-in [:page-root] (fnil str ""))
(update-in [:post-root] (fnil str "")) (update-in [:post-root] (fnil str ""))

View file

@ -71,12 +71,11 @@ if no, return empty vector."
(let [assets (cp-io/get-resources fs-prefix base-path paths) (let [assets (cp-io/get-resources fs-prefix 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 #(= (cp-io/get-file-extension-from-resource %) ext) xs)) filter-ext (fn [xs] (filter #(= (cp-io/get-file-extension-from-resource %) ext) xs))
cast-file (fn [java-path] (io/as-file (.toString java-path))) get-java-file (fn [map-entry] (.toFile (:java-path map-entry)))]
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)))) (map get-java-file))))
; ;
; ;