Mercurial > lasercutter
comparison src/clojure/contrib/classpath.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 ;;; classpath.clj: utilities for working with the Java class path | |
2 | |
3 ;; by Stuart Sierra, http://stuartsierra.com/ | |
4 ;; April 19, 2009 | |
5 | |
6 ;; Copyright (c) Stuart Sierra, 2009. All rights reserved. The use | |
7 ;; and distribution terms for this software are covered by the Eclipse | |
8 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
9 ;; which can be found in the file epl-v10.html at the root of this | |
10 ;; distribution. By using this software in any fashion, you are | |
11 ;; agreeing to be bound by the terms of this license. You must not | |
12 ;; remove this notice, or any other, from this software. | |
13 | |
14 | |
15 (ns | |
16 ^{:author "Stuart Sierra", | |
17 :doc "Utilities for dealing with the JVM's classpath"} | |
18 clojure.contrib.classpath | |
19 (:require [clojure.contrib.jar :as jar]) | |
20 (:import (java.io File) | |
21 (java.util.jar JarFile))) | |
22 | |
23 (defn classpath | |
24 "Returns a sequence of File objects of the elements on CLASSPATH." | |
25 [] | |
26 (map #(File. %) | |
27 (.split (System/getProperty "java.class.path") | |
28 (System/getProperty "path.separator")))) | |
29 | |
30 (defn classpath-directories | |
31 "Returns a sequence of File objects for the directories on classpath." | |
32 [] | |
33 (filter #(.isDirectory %) (classpath))) | |
34 | |
35 (defn classpath-jarfiles | |
36 "Returns a sequence of JarFile objects for the JAR files on classpath." | |
37 [] | |
38 (map #(JarFile. %) (filter jar/jar-file? (classpath)))) | |
39 |