Raynes / fs

File system utilities for Clojure.
453 stars 119 forks source link

Change 'expand-home' to support Unix style paths on windows. #73

Open nurous opened 10 years ago

nurous commented 10 years ago

expand-home does not add the home to the path when on windows and the path string uses unix style path separators (which is generally OK in Java). Fix seems to be just ensure the path passed in is converted to a File object first which will convert the unix style separators to File/separator.

Raynes commented 8 years ago

https://github.com/Raynes/fs/pull/87 Solves this, right?

hanshuebner commented 8 years ago

This problem is not solved by #87:

me.raynes.fs> (expand-home "~/test.txt")
#object[java.io.File 0x6bafd5ca "C:\\Users\\test.txt"]
me.raynes.fs> (expand-home "~\\test.txt")
#object[java.io.File 0x5cc7b90a "C:\\Users\\hans\\test.txt"]

As you see, if a forward slash is used as path separator, the path is corrected incorrectly, while it is correctly constructed with a backslash.

nurous commented 3 years ago

@Raynes Do you want to merge this or should I close it?