diff --git a/src/cryogen_core/classpath_able_io/fs.clj b/src/cryogen_core/classpath_able_io/fs.clj index 2626212..4fe8656 100644 --- a/src/cryogen_core/classpath_able_io/fs.clj +++ b/src/cryogen_core/classpath_able_io/fs.clj @@ -17,12 +17,16 @@ ; ----------------------- Domain functions ------------------------ (def no-link-option (into-array [LinkOption/NOFOLLOW_LINKS])) +(def follow-link-option (into-array [])) + +(defn user-dir [] + (java.lang.System/getProperty "user.dir")) (s/defn path [full-path] - (let [path-from-fs (Paths/get (URI. (str "file://" full-path)))] ;fragile + (let [path-from-fs (Paths/get (URI. (str "file://" (user-dir) "/" full-path)))] (try - (when (Files/exists path-from-fs no-link-option) + (when (Files/exists path-from-fs follow-link-option) path-from-fs) (catch Exception e nil)))) diff --git a/test/cryogen_core/classpath_able_io/fs_test.clj b/test/cryogen_core/classpath_able_io/fs_test.clj index 0bbe859..7ae1c2b 100644 --- a/test/cryogen_core/classpath_able_io/fs_test.clj +++ b/test/cryogen_core/classpath_able_io/fs_test.clj @@ -17,4 +17,7 @@ (deftest test-path (is - (sut/path (str fs-root "dummy/dummy_from_fs")))) + (sut/path (str fs-root "/dummy/dummy_from_fs"))) + (is + (= nil + (sut/path (str fs-root "/not-existing")))))