Fix symbol-not-found and Nullpointer-Exception
This commit is contained in:
parent
3300dce8ae
commit
64a3b1d62c
1 changed files with 17 additions and 8 deletions
|
@ -41,23 +41,33 @@
|
||||||
from-fs
|
from-fs
|
||||||
(file-from-cp resource-path))))
|
(file-from-cp resource-path))))
|
||||||
|
|
||||||
|
(defn copy-file
|
||||||
|
[source-file ;first element of (.list source-dir)
|
||||||
|
target-file]
|
||||||
|
(do (io/make-parents target-file)
|
||||||
|
(io/copy source-file target-file)))
|
||||||
|
|
||||||
(defn copy-dir
|
(defn copy-dir
|
||||||
[source-dir target-dir ignore-patterns]
|
[source-dir target-dir ignore-patterns]
|
||||||
(loop [l-source-list (.list source-dir)
|
(loop [l-source-list (.list source-dir)
|
||||||
l-source-dir source-dir
|
l-source-dir source-dir
|
||||||
l-target-dir target-dir]
|
l-target-dir target-dir]
|
||||||
|
(println (str "source-dir: " source-dir " target-dir: " target-dir " f: ") (first l-source-list) " second: " (second l-source-list))
|
||||||
(let [f (first l-source-list)
|
(let [f (first l-source-list)
|
||||||
|
second? (not (nil? (second l-source-list)))
|
||||||
target-file (io/file target-dir f)
|
target-file (io/file target-dir f)
|
||||||
source-file (io/file source-dir f)]
|
source-file (io/file source-dir f)]
|
||||||
|
; TODO: .isFile is called on wrong path to the actual file, does not consider the path leading to the subdirectory of the file
|
||||||
|
(println "type of f: " (type f))
|
||||||
(if (.isFile source-file)
|
(if (.isFile source-file)
|
||||||
(do
|
(do
|
||||||
;; TODO: Move the following to a new copy-file function
|
(copy-file f target-file)
|
||||||
(io/make-parents target-file)
|
|
||||||
(io/copy f target-file)
|
|
||||||
;; continue copying files
|
;; continue copying files
|
||||||
(recur (drop 1 source-list) source-dir target-dir))
|
(when second?
|
||||||
|
(recur (drop 1 l-source-list) source-dir target-dir)))
|
||||||
;; recur down to contained directory
|
;; recur down to contained directory
|
||||||
(recur (drop 1 source-list) source-file target-file)))))
|
(do (println (type (.list source-file)))
|
||||||
|
(when second? (recur (concat (.list source-file) (drop 1 l-source-list)) source-file target-file)))))))
|
||||||
|
|
||||||
(defn copy-resources
|
(defn copy-resources
|
||||||
[fs-prefix source-path target-path ignore-patterns]
|
[fs-prefix source-path target-path ignore-patterns]
|
||||||
|
@ -69,12 +79,11 @@
|
||||||
(throw (IllegalArgumentException. (str "resource " source-path " not found")))
|
(throw (IllegalArgumentException. (str "resource " source-path " not found")))
|
||||||
is-source-dir?
|
is-source-dir?
|
||||||
(copy-dir source-file target-file ignore-patterns)
|
(copy-dir source-file target-file ignore-patterns)
|
||||||
:else
|
:else (copy-file source-file target-file)
|
||||||
nil
|
|
||||||
;; TODO: Call copy-file fct. - take care on parameter.
|
;; TODO: Call copy-file fct. - take care on parameter.
|
||||||
;(fs/copy src target)
|
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
|
||||||
(defn copy-resources-from-theme
|
(defn copy-resources-from-theme
|
||||||
[fs-prefix theme target-path]
|
[fs-prefix theme target-path]
|
||||||
(let [theme-path (str "templates/themes/" theme)]
|
(let [theme-path (str "templates/themes/" theme)]
|
||||||
|
|
Loading…
Reference in a new issue