Switch to clojure.java.io/resource here

This commit is contained in:
Michael S. Klishin 2011-12-16 11:12:55 +04:00
parent f49e272f9f
commit 57c4ad6e9b
2 changed files with 4 additions and 7 deletions

View file

@ -1,5 +1,5 @@
(ns monger.js (ns monger.js
(:require [clojure.java.io])) (:require [clojure.java.io :as io]))
;; ;;
;; Implementation ;; Implementation
@ -19,7 +19,4 @@
(defn load-resource (defn load-resource
(^String [^String path] (^String [^String path]
(with-open [rdr (clojure.java.io/reader (-> (Thread/currentThread) (slurp (io/resource (normalize-resource path)))))
.getContextClassLoader
(.getResourceAsStream (normalize-resource path))))]
(reduce str "" (line-seq rdr)))))

View file

@ -6,5 +6,5 @@
(deftest load-js-resource-using-path-on-the-classpath (deftest load-js-resource-using-path-on-the-classpath
(are [c path] (= c (count (monger.js/load-resource path))) (are [c path] (= c (count (monger.js/load-resource path)))
60 "resources/mongo/js/mapfun1.js" 62 "resources/mongo/js/mapfun1.js"
60 "resources/mongo/js/mapfun1")) 62 "resources/mongo/js/mapfun1"))