|
|
|
@ -8,7 +8,8 @@
|
|
|
|
|
|
|
|
|
|
(ns cryogen-core.classpath-able-io
|
|
|
|
|
(:require [clojure.java.io :as io]
|
|
|
|
|
[clojure.string :as s]))
|
|
|
|
|
[clojure.string :as s]
|
|
|
|
|
[schema.core :as s]))
|
|
|
|
|
|
|
|
|
|
(def public "resources/public")
|
|
|
|
|
|
|
|
|
@ -22,21 +23,32 @@
|
|
|
|
|
|
|
|
|
|
(defn filter-for-ignore-patterns
|
|
|
|
|
[ignore-patterns source-list]
|
|
|
|
|
(filter #(not (re-matches ignore-patterns %)) source-list))
|
|
|
|
|
(filter #(not (re-matches ignore-patterns %)) source -list))
|
|
|
|
|
|
|
|
|
|
; TODO: Datenstruktur [s/Str]
|
|
|
|
|
|
|
|
|
|
(defn delete-file-recursive
|
|
|
|
|
[folders]
|
|
|
|
|
(when (not (empty? folders))
|
|
|
|
|
(let [file-to-work-with (first folders)
|
|
|
|
|
; TODO: .list fehlt noch
|
|
|
|
|
file-list (filter #(.isFile %) file-to-work-with)
|
|
|
|
|
dir-list (filter #(not (.isFile %)) file-to-work-with)]
|
|
|
|
|
(doseq [file file-list] (io/delete-file file))
|
|
|
|
|
(when (not (empty? dir-list))
|
|
|
|
|
(recur (drop 1 dir-list)))
|
|
|
|
|
(io/delete-file file-to-work-with))))
|
|
|
|
|
(s/defn get-file-paths-recursive :- [s/Str]
|
|
|
|
|
[base-path :- s/Str
|
|
|
|
|
paths :- [s/Str]]
|
|
|
|
|
(loop [paths paths
|
|
|
|
|
result []]
|
|
|
|
|
(when (not (empty? paths))
|
|
|
|
|
(let [path-to-work-with (first paths)
|
|
|
|
|
path-content (.list (io/file (str base-path "/" path-to-work-with)))
|
|
|
|
|
file-list (filter #(.isFile %) path-content)
|
|
|
|
|
dir-list (filter #(not (.isFile %)) path-content)]))))
|
|
|
|
|
|
|
|
|
|
; (defn delete-file-recursive
|
|
|
|
|
; [folders]
|
|
|
|
|
; (when (not (empty? folders))
|
|
|
|
|
; (let [file-to-work-with (first folders)
|
|
|
|
|
; ; TODO: .list fehlt noch
|
|
|
|
|
; file-list (filter #(.isFile %) file-to-work-with)
|
|
|
|
|
; dir-list (filter #(not (.isFile %)) file-to-work-with)]
|
|
|
|
|
; (doseq [file file-list] (io/delete-file file))
|
|
|
|
|
; (when (not (empty? dir-list))
|
|
|
|
|
; (recur (drop 1 dir-list)))
|
|
|
|
|
; (io/delete-file file-to-work-with))))
|
|
|
|
|
|
|
|
|
|
(defn file-from-cp
|
|
|
|
|
[resource-path]
|
|
|
|
|