added ignore-patterns to delete
Co-authored-by: Jan Krebs <jan.krebs@student.uni-tuebingen.de>
This commit is contained in:
parent
ba678e848f
commit
137705e81c
1 changed files with 16 additions and 13 deletions
|
@ -32,7 +32,7 @@
|
|||
|
||||
(defn filter-for-ignore-patterns
|
||||
[ignore-patterns source-list]
|
||||
(filter #(not (re-matches ignore-patterns %)) source-list))
|
||||
(filter #(not (re-matches (re-pattern ignore-patterns) %)) source-list))
|
||||
|
||||
(defn filter-resources-for-ignore-patterns
|
||||
[ignore-patterns resources]
|
||||
|
@ -107,7 +107,8 @@
|
|||
|
||||
; TODO: Add files to keep
|
||||
(s/defn delete-resources!
|
||||
[virtual-path :- s/Str]
|
||||
([virtual-path :- s/Str] (delete-resources! virtual-path nil))
|
||||
([virtual-path :- s/Str ignore-patterns]
|
||||
(let [resource-paths
|
||||
(reverse
|
||||
(sort
|
||||
|
@ -115,9 +116,11 @@
|
|||
(str (fs/user-dir) "/")
|
||||
virtual-path
|
||||
[""]
|
||||
:from-cp false)))]
|
||||
(do
|
||||
(doseq [resource-path resource-paths]
|
||||
:from-cp false)))
|
||||
resource-paths-filtered (if ignore-patterns
|
||||
(filter-for-ignore-patterns ignore-patterns resource-paths)
|
||||
resource-paths)]
|
||||
(doseq [resource-path resource-paths-filtered]
|
||||
(Files/delete (fs/absolut-path virtual-path resource-path))))))
|
||||
|
||||
(defn copy-resources!
|
||||
|
|
Loading…
Reference in a new issue