Permalink
Browse files

Use dynapath for reading the effective classpath from the cass loader.

This allows loader-classpath to work with non-URLClassLoaders. Any class loader
that extends dynapath.core/DynamicClasspath and is readable can now be used
with bultitude.
  • Loading branch information...
1 parent db0f375 commit a4cb1704475e24549287ddcfd4409fd427574a77 @tobias tobias committed Oct 3, 2012
Showing with 6 additions and 4 deletions.
  1. +2 −1 project.clj
  2. +4 −3 src/bultitude/core.clj
View
@@ -2,7 +2,8 @@
:min-lein-version "2.0.0"
:description "A library for find Clojure namespaces on the classpath."
:url "https://github.com/Raynes/bultitude"
- :dependencies [[org.clojure/clojure "1.4.0"]]
+ :dependencies [[org.clojure/clojure "1.4.0"]
+ [dynapath "0.1.0"]]
:aliases {"test-all" ["with-profile" "dev,default:dev,1.3,default:dev,1.2,default" "test"]}
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}})
@@ -1,6 +1,7 @@
(ns bultitude.core
(:require [clojure.java.io :as io]
- [clojure.string :as string])
+ [clojure.string :as string]
+ [dynapath.core :as dp])
(:import (java.util.jar JarFile)
(java.util.zip ZipException)
(java.io File BufferedReader PushbackReader InputStreamReader)
@@ -63,8 +64,8 @@
(defn loader-classpath
"Returns a sequence of File paths from a classloader."
[loader]
- (when (instance? java.net.URLClassLoader loader)
- (map io/as-file (.getURLs ^java.net.URLClassLoader loader))))
+ (when (dp/readable-classpath? loader)
+ (map io/as-file (dp/classpath-urls loader))))
(defn classpath-files
"Returns a sequence of File objects of the elements on the classpath."

0 comments on commit a4cb170

Please sign in to comment.