Permalink
Browse files

fixed an error that "Create" action cannot find "skelton.clj" in JAR.

  • Loading branch information...
fukamachi committed Jan 6, 2011
1 parent da5d505 commit df8a0b0b02ed8e5e3fe155454b7203c47aa23ecb
Showing with 8 additions and 2 deletions.
  1. +2 −1 project.clj
  2. 0 { → resource}/skelton.clj
  3. +6 −1 src/L5/file.clj
View
@@ -18,4 +18,5 @@
[swank-clojure "1.2.1"]]
:repositories {"clojars" "http://clojars.org/repo"
"itextpdf" "http://maven.itextpdf.com/"}
- :uberjar-name "L5.jar")
+ :uberjar-name "L5.jar"
+ :resources-path "resource")
File renamed without changes.
View
@@ -6,6 +6,11 @@
[java.awt GridLayout]
[java.awt.event ActionListener]))
+(defn- load-resource [name]
+ (let [thr (Thread/currentThread)
+ ldr (.getContextClassLoader thr)]
+ (.getResourceAsStream ldr name)))
+
(def presen-filter (FileNameExtensionFilter. "Presentation (.clj .lgo)" (into-array ["clj" "lgo"])))
(def pdf-filter (FileNameExtensionFilter. "PDF (.pdf)" (into-array ["pdf"])))
@@ -43,7 +48,7 @@
(actionPerformed [e]
(save-dialog frame
#(let [file (File. %)]
- (io/copy (File. "skelton.clj") file)
+ (io/copy (load-resource "skelton.clj") file)
(open-file file))
presen-filter)))]
(.addActionListener button action)

0 comments on commit df8a0b0

Please sign in to comment.