From c19498abbb2e2421eed7040931f9f416a815cb16 Mon Sep 17 00:00:00 2001 From: Jan Krebs Date: Tue, 3 Dec 2019 17:33:48 +0100 Subject: [PATCH] "mob next [ci-skip]" --- src/cryogen_core/classpath_able_io.clj | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index 687148f..1331bdf 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -3,18 +3,31 @@ [clojure.string :as s] [me.raynes.fs :as fs])) +(defn copy-dir + [source-path target-path ignored-files] + (fs/mkdirs target-path) + (let [^java.io.FilenameFilter filename-filter (apply reject-re-filter ignored-files) + files (.listFiles (io/file source-path) filename-filter)] + (doseq [^java.io.File f files] + (let [out (io/file target-path (.getName f))] + (if (.isDirectory f) + (copy-dir f out ignored-files) + (io/copy f out)))))) + (defn copy-resources [source-path target-path] - (cond + (let [ignored-files []] + (cond (not (.exists (io/file source-path))) (throw (IllegalArgumentException. (str "resource " source-path " not found"))) (.isDirectory (io/file source-path)) (copy-dir source-path target-path ignored-files) :else - (fs/copy source-path target-path))) + (fs/copy source-path target-path)))) (defn copy-resources-from-theme [theme target] (let [source-path (str "templates/themes/" theme "/js") target-path (str target "/js")] copy-resources source-path target-path)) +