template writing done
This commit is contained in:
parent
a9dc6dddf2
commit
adecde4890
|
@ -44,15 +44,10 @@ already opend buffer died after reading content."
|
||||||
"Write the STRING into FILE if file was writable."
|
"Write the STRING into FILE if file was writable."
|
||||||
(if (file-writable-p FILE)
|
(if (file-writable-p FILE)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert STR)
|
(insert STRING)
|
||||||
(write-region (point-min)
|
(write-region (point-min)
|
||||||
(point-max)
|
(point-max)
|
||||||
FILE)
|
FILE)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defun io/join-path (a b)
|
|
||||||
"safe join a and b addresses."
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
|
@ -109,11 +109,12 @@ destenation file address created from template FILE name.
|
||||||
|
|
||||||
(let (curfile destfile)
|
(let (curfile destfile)
|
||||||
(setq curfile (split-string FILE "/"))
|
(setq curfile (split-string FILE "/"))
|
||||||
|
|
||||||
(setq curfile (car (last curfile)))
|
(setq curfile (car (last curfile)))
|
||||||
(setq curfile (replace-regexp-in-string "__project__" unix-project-name curfile))
|
(setq curfile (replace-regexp-in-string "__project__" unix-project-name curfile))
|
||||||
(setq curfile (replace-regexp-in-string "\.tmpl" "" curfile))
|
(setq curfile (replace-regexp-in-string "\.tmpl" "" curfile))
|
||||||
(setq destfile (concat project-path curfile))
|
;; safe path join (path generated here)
|
||||||
(log destfile)
|
(setq destfile (expand-file-name curfile project-path))
|
||||||
|
(io/write destfile DATA)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue