copy-to-jar :bytes needs to unix-path the :path

All of the other copy-to-jar methods call unix-path on (:path spec),
thus ensuring that files added to the jar from a Windows machine end up
with Unix-style path names.  The byte array variant of copy-to-jar is
the one exception though and the result is that tools such as
lein-cljsbuild will leave Windows-style paths in jar files generated
with the "lein jar" command.
This commit is contained in:
Michael Alyn Miller 2013-06-11 20:55:09 -07:00
parent 8f566613df
commit 7bd6b26bf3

View file

@ -91,13 +91,14 @@
{:type :path :path path}))) {:type :path :path path})))
(defmethod copy-to-jar :bytes [project jar-os acc spec] (defmethod copy-to-jar :bytes [project jar-os acc spec]
(when-not (some #(re-find % (:path spec)) (:jar-exclusions project)) (let [path (unix-path (:path spec))]
(.putNextEntry jar-os (JarEntry. (:path spec))) (when-not (some #(re-find % path) (:jar-exclusions project))
(let [bytes (if (string? (:bytes spec)) (.putNextEntry jar-os (JarEntry. path))
(.getBytes (:bytes spec)) (let [bytes (if (string? (:bytes spec))
(:bytes spec))] (.getBytes (:bytes spec))
(io/copy (ByteArrayInputStream. bytes) jar-os))) (:bytes spec))]
(conj acc (:path spec))) (io/copy (ByteArrayInputStream. bytes) jar-os)))
(conj acc path)))
(defmethod copy-to-jar :fn [project jar-os acc spec] (defmethod copy-to-jar :fn [project jar-os acc spec]
(let [f (eval (:fn spec)) (let [f (eval (:fn spec))