From 7bd6b26bf3d5a2b976ce4ac3f8233dca41fa9e20 Mon Sep 17 00:00:00 2001 From: Michael Alyn Miller Date: Tue, 11 Jun 2013 20:55:09 -0700 Subject: [PATCH] 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. --- src/leiningen/jar.clj | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/leiningen/jar.clj b/src/leiningen/jar.clj index 79ae76df..61a3787a 100644 --- a/src/leiningen/jar.clj +++ b/src/leiningen/jar.clj @@ -91,13 +91,14 @@ {:type :path :path path}))) (defmethod copy-to-jar :bytes [project jar-os acc spec] - (when-not (some #(re-find % (:path spec)) (:jar-exclusions project)) - (.putNextEntry jar-os (JarEntry. (:path spec))) - (let [bytes (if (string? (:bytes spec)) - (.getBytes (:bytes spec)) - (:bytes spec))] - (io/copy (ByteArrayInputStream. bytes) jar-os))) - (conj acc (:path spec))) + (let [path (unix-path (:path spec))] + (when-not (some #(re-find % path) (:jar-exclusions project)) + (.putNextEntry jar-os (JarEntry. path)) + (let [bytes (if (string? (:bytes spec)) + (.getBytes (:bytes spec)) + (:bytes spec))] + (io/copy (ByteArrayInputStream. bytes) jar-os))) + (conj acc path))) (defmethod copy-to-jar :fn [project jar-os acc spec] (let [f (eval (:fn spec))