aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-06-29 15:48:06 +0000
committerscgilardi <scgilardi@gmail.com>2008-06-29 15:48:06 +0000
commita2df976434057a815d2eed6cfdfacb328d3ea818 (patch)
tree0dfdfa6df4129b10b9ee96ec1dd8b97b4d184015
parente8184143755a9dfa7c37f248e89754931fb7df20 (diff)
lib.clj: fix visibility of *class-loaders* and refine naming
-rw-r--r--lib.clj29
1 files changed, 15 insertions, 14 deletions
diff --git a/lib.clj b/lib.clj
index 829d9dc6..172d8c75 100644
--- a/lib.clj
+++ b/lib.clj
@@ -261,13 +261,13 @@
"Loads Clojure source from a resource specified by java.net.URI
java.net.URL, or String. Accepts any URI scheme supported by
java.net.URLConnection (http and jar), plus file URIs."
- [resource]
+ [loc]
(let [url (cond ; coerce argument into URL
- (instance? URL resource) resource
- (instance? URI resource) (.toURL resource)
- (string? resource) (URL. resource)
+ (instance? URL loc) loc
+ (instance? URI loc) (.toURL loc)
+ (string? loc) (URL. loc)
:else (throw (Exception.
- (str "Cannot coerce " (class resource)
+ (str "Cannot coerce " (class loc)
" to java.net.URL."))))]
(with-open reader
(BufferedReader.
@@ -280,12 +280,13 @@
;; an instance of clojure.lang.DynamicClassLoader, and can be updated
;; with clojure/add-classpath.
-(def *class-loaders*
- #^{:private true :doc
- "A set of available class loaders"}
- (set [(.getSystemClassLoader ClassLoader)
- (.getClassLoader (identity RT))
- (.ROOT_CLASSLOADER RT)]))
+(def
+ #^{:private true :doc
+ "A set of available class loaders"}
+ *class-loaders*
+ (set [(.getSystemClassLoader ClassLoader)
+ (.getClassLoader (identity RT))
+ (.ROOT_CLASSLOADER RT)]))
(defn find-system-resource
"Searches for the resource in available ClassLoaders. Returns a
@@ -295,7 +296,7 @@
(defn load-system-resource
"Loads Clojure source from a resource within classpath"
- [resource]
- (if-let url (find-system-resource resource)
+ [name]
+ (if-let url (find-system-resource name)
(load-resource url)
- (throw (Exception. (str "Cannot find resource " resource)))))
+ (throw (Exception. (str "Cannot find resource " name)))))