File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed
src/main/clojure/clojure/tools/namespace Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change 25
25
(with-open [rdr (PushbackReader. (io/reader file))]
26
26
(parse/read-ns-decl rdr read-opts))))
27
27
28
+ (defn file-with-extension?
29
+ " Returns true if the java.io.File represents a file whose name ends
30
+ with one of the Strings in extensions."
31
+ {:added " 0.3.0" }
32
+ [^java.io.File file extensions]
33
+ (and (.isFile file)
34
+ (let [name (.getName file)]
35
+ (some #(.endsWith name %) extensions))))
36
+
37
+ (def ^{:added " 0.3.0" }
38
+ clojure-extensions
39
+ " File extensions for Clojure (JVM) files."
40
+ (list " .clj" " .cljc" ))
41
+
42
+ (def ^{:added " 0.3.0" }
43
+ clojurescript-extensions
44
+ " File extensions for ClojureScript files."
45
+ (list " .cljs" " .cljc" ))
46
+
28
47
(defn clojure-file?
29
48
" Returns true if the java.io.File represents a file which will be
30
49
read by the Clojure (JVM) compiler."
31
50
[^java.io.File file]
32
- (and (.isFile file)
33
- (or
34
- (.endsWith (.getName file) " .clj" )
35
- (.endsWith (.getName file) " .cljc" ))))
51
+ (file-with-extension? file clojure-extensions))
36
52
37
53
(defn clojurescript-file?
38
54
" Returns true if the java.io.File represents a file which will be
39
55
read by the ClojureScript compiler."
40
56
{:added " 0.3.0" }
41
57
[^java.io.File file]
42
- (and (.isFile file)
43
- (or
44
- (.endsWith (.getName file) " .cljs" )
45
- (.endsWith (.getName file) " .cljc" ))))
58
+ (file-with-extension? file clojurescript-extensions))
46
59
47
60
; ;; Dependency tracker
48
61
You can’t perform that action at this time.
0 commit comments