From d2b7b86e0b35b0826a56cdff92f51b9da44b4691 Mon Sep 17 00:00:00 2001 From: jem Date: Tue, 17 Dec 2019 18:55:46 +0100 Subject: [PATCH] removed duplicated code --- src/cryogen_core/classpath_able_io.clj | 28 ++++++-------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index 254ec4a..0dc7142 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -165,28 +165,12 @@ & {:keys [from-cp from-fs] :or {from-cp true from-fs true}}] - (loop [paths paths - result []] - (if (not (empty? paths)) - (do - (let [path-to-work-with (first paths) - resource-to-work-with (resource-from-cp-or-fs - fs-prefix - base-path - path-to-work-with - :from-cp from-cp - :from-fs from-fs) - result (into result [path-to-work-with])] - (cond - (nil? resource-to-work-with) [] - (= :file (:resource-type resource-to-work-with)) (recur (drop 1 paths) result) - :else - (recur (into (drop 1 paths) - (map #(str path-to-work-with "/" %) - (.list (:file resource-to-work-with)))) - result) - ))) - result))) + (map #(:path %) + (get-resources-recursive + fs-prefix base-path paths + :from-cp from-cp + :from-fs from-fs)) + ) ; TODO: Add files to keep (s/defn delete-resource-recursive!