From 07e67ad89ca1974c6ce5b327edfad3e38d17a6a9 Mon Sep 17 00:00:00 2001 From: David Reed Date: Wed, 5 Mar 2014 12:08:43 +1100 Subject: [PATCH 1/2] Change 'expand-home' to support Unix style paths even on windows. --- src/me/raynes/fs.clj | 2 +- test/me/raynes/core_test.clj | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/raynes/fs.clj b/src/me/raynes/fs.clj index 16ccaab..658ef4a 100644 --- a/src/me/raynes/fs.clj +++ b/src/me/raynes/fs.clj @@ -37,7 +37,7 @@ This is (naively) assumed to be a directory with the same name as the user relative to the parent of the current value of user.home." [path] - (let [path (str path)] + (let [path (str (io/as-file path))] (if (.startsWith path "~") (let [sep (.indexOf path File/separator)] (if (neg? sep) diff --git a/test/me/raynes/core_test.clj b/test/me/raynes/core_test.clj index a1917c4..a159df3 100644 --- a/test/me/raynes/core_test.clj +++ b/test/me/raynes/core_test.clj @@ -8,6 +8,7 @@ (:import java.io.File)) (def system-tempdir (System/getProperty "java.io.tmpdir")) +(def on-windows? (= File/separator "\\")) (defn create-walk-dir [] (let [root (temp-dir "fs-")] @@ -25,6 +26,7 @@ (fact "Expands path to current user." (let [user (System/getProperty "user.home")] (expand-home "~") => (file user) + (expand-home "~/foo") => (file user "foo") (expand-home (str "~" File/separator "foo")) => (file user "foo"))) (fact "Expands to given user." From 5d5826b6083524e39d27dde70a7ab1a9e79024ea Mon Sep 17 00:00:00 2001 From: David Reed Date: Wed, 5 Mar 2014 12:11:49 +1100 Subject: [PATCH 2/2] Remove unused code --- test/me/raynes/core_test.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/test/me/raynes/core_test.clj b/test/me/raynes/core_test.clj index a159df3..4a1bd9f 100644 --- a/test/me/raynes/core_test.clj +++ b/test/me/raynes/core_test.clj @@ -8,7 +8,6 @@ (:import java.io.File)) (def system-tempdir (System/getProperty "java.io.tmpdir")) -(def on-windows? (= File/separator "\\")) (defn create-walk-dir [] (let [root (temp-dir "fs-")]