renamed copy-dir
This commit is contained in:
parent
0a9ee92a27
commit
b49ebe6186
1 changed files with 5 additions and 12 deletions
|
@ -33,7 +33,7 @@
|
||||||
file-from-fs)
|
file-from-fs)
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
(defn file-from-cp-or-filesystem
|
(defn file-from-cp-or-filesystem
|
||||||
[fs-prefix resource-path]
|
[fs-prefix resource-path]
|
||||||
(let [from-fs (file-from-fs fs-prefix resource-path)]
|
(let [from-fs (file-from-fs fs-prefix resource-path)]
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
(file-from-cp resource-path))))
|
(file-from-cp resource-path))))
|
||||||
|
|
||||||
(defn copy-file
|
(defn copy-file
|
||||||
[source-file ;first element of (.list source-dir)
|
[source-file
|
||||||
target-file]
|
target-file]
|
||||||
(do (io/make-parents target-file)
|
(do (io/make-parents target-file)
|
||||||
(io/copy source-file target-file)))
|
(io/copy source-file target-file)))
|
||||||
|
|
||||||
(defn copy-dir
|
(defn do-copy
|
||||||
[source-dir target-dir ignore-patterns]
|
[source-dir target-dir ignore-patterns]
|
||||||
(loop [source-list (.list source-dir)
|
(loop [source-list (.list source-dir)
|
||||||
file-path-prefix [""]]
|
file-path-prefix [""]]
|
||||||
|
@ -70,15 +70,9 @@
|
||||||
(let [source-file (file-from-cp-or-filesystem fs-prefix source-path)
|
(let [source-file (file-from-cp-or-filesystem fs-prefix source-path)
|
||||||
target-file (io/file target-path source-path)
|
target-file (io/file target-path source-path)
|
||||||
is-source-dir? (.isDirectory source-file)]
|
is-source-dir? (.isDirectory source-file)]
|
||||||
(cond
|
(if (nil? source-file)
|
||||||
(nil? source-file)
|
|
||||||
(throw (IllegalArgumentException. (str "resource " source-path " not found")))
|
(throw (IllegalArgumentException. (str "resource " source-path " not found")))
|
||||||
is-source-dir?
|
(do-copy source-file target-file ignore-patterns))))
|
||||||
(copy-dir source-file target-file ignore-patterns)
|
|
||||||
:else (copy-file source-file target-file)
|
|
||||||
;; TODO: Call copy-file fct. - take care on parameter.
|
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
||||||
(defn copy-resources-from-theme
|
(defn copy-resources-from-theme
|
||||||
[fs-prefix theme target-path]
|
[fs-prefix theme target-path]
|
||||||
|
@ -86,4 +80,3 @@
|
||||||
(copy-resources fs-prefix (str theme-path "/css") target-path "")
|
(copy-resources fs-prefix (str theme-path "/css") target-path "")
|
||||||
(copy-resources fs-prefix (str theme-path "/js") target-path "")
|
(copy-resources fs-prefix (str theme-path "/js") target-path "")
|
||||||
(copy-resources fs-prefix (str theme-path "/html/404.html") target-path "")))
|
(copy-resources fs-prefix (str theme-path "/html/404.html") target-path "")))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue