wip
This commit is contained in:
parent
636bfc6f41
commit
4d467957ee
2 changed files with 21 additions and 3 deletions
|
@ -14,9 +14,27 @@
|
||||||
[ignore-patterns source-list]
|
[ignore-patterns source-list]
|
||||||
(filter #(not (re-matches ignore-patterns %)) source-list))
|
(filter #(not (re-matches ignore-patterns %)) source-list))
|
||||||
|
|
||||||
(defn wipe-folder
|
(defn delete-file-recursive
|
||||||
[folder]
|
[folder]
|
||||||
(io/delete-file "target/tmp"))
|
(loop [folder-list (.list folder)
|
||||||
|
file-list (filter )
|
||||||
|
|
||||||
|
file-path-prefix [""]]
|
||||||
|
(let [f (first source-list)
|
||||||
|
second? (not (nil? (second source-list)))
|
||||||
|
source-file (io/file folder (str (first file-path-prefix) f))]
|
||||||
|
(if (.isFile source-file)
|
||||||
|
(do
|
||||||
|
(io/delete-file source-file)
|
||||||
|
(when second?
|
||||||
|
(recur (drop 1 source-list) file-path-prefix)))
|
||||||
|
(let [sub-dir-list (.list source-file)
|
||||||
|
sub-dir-list-count (count sub-dir-list)]
|
||||||
|
(when (> sub-dir-list-count 0)
|
||||||
|
(recur (concat sub-dir-list (drop 1 source-list))
|
||||||
|
(concat (repeat sub-dir-list-count
|
||||||
|
(str (first file-path-prefix) f "/"))
|
||||||
|
(drop 1 file-path-prefix)))))))))
|
||||||
|
|
||||||
(defn file-from-cp
|
(defn file-from-cp
|
||||||
[resource-path]
|
[resource-path]
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
(is
|
(is
|
||||||
(do
|
(do
|
||||||
(.mkdir (io/file target))
|
(.mkdir (io/file target))
|
||||||
(sut/wipe-folder target)
|
(sut/delete-file-recursive (io/file target))
|
||||||
(not (verify-dir-exists target)))))
|
(not (verify-dir-exists target)))))
|
||||||
|
|
||||||
(deftest test-file-from-cp-or-filesystem
|
(deftest test-file-from-cp-or-filesystem
|
||||||
|
|
Loading…
Reference in a new issue