Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in ClojureCLR by

The ClojureCLR version of io/as-file returns a FileInfo object, which can only represent a file (and not a directory as those are represented by the DirectoryInfo class). JVM CLojure OTOH returns a File object, which can represent both. This leads to different outcomes in evaluation:

Clojure

user=> (require '[clojure.java.io :as io])
nil
user=> (.exists (io/as-file "/"))
true

ClojureCLR

user=> (require '[clojure.clr.io :as io])
nil
user=> (.Exists (io/as-file "/"))
false

Suggested fix would be to return a FileSystemInfo object, which is the parent class of both FileInfo and DirectoryInfo, and as such is capable of representing both, similar to the Java File class.

Please log in or register to answer this question.

...