On Wed, 29 Sep 2010 at 15:18, David Jagoe wrote:
> Anyone know of a utility that returns a absolute filename given a
> namespace symbol?
If you're using Emacs/SLIME, you could use swank-clojure's classpath browsing
information. The var "available-classes" in namespace "swank.util.class-browse"
holds clojure namespaces and java classes on the classpath as a list of maps.
For example to see where the clojure.set namespace comes from:
user> (clojure.pprint/pprint
(filter #(= (:name %) "clojure.set")
swank.util.class-browse/available-classes))
({:loc "/home/jeff/.clojure/clojure-1.3.0-alpha1.jar",
:file "clojure/set__init.class",
:name "clojure.set"})
The same applies to java classes:
user> (clojure.pprint/pprint
(filter #(= (:name %) "java.net.Socket")
swank.util.class-browse/available-classes))
({:loc "/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar",
:file "java/net/Socket.class",
:name "java.net.Socket"})
The map keys are as follows:
:name Java class or Clojure namespace name
:loc Classpath entry (directory or jar) on which the class is located
:file Path of the class file, relative to :loc
Also see: (doc swank.util.class-browse)
Hope this helps!
- Jeff
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en