[Suggestion] Add function to fix paths for different OS
I usually face a problem of incorrect paths or part of paths. To fix this, I use the following workaround:
(defn- fix-path [p]
(if (not (nil? p))
(if (.startsWith (System/getProperty "os.name") "Windows")
(string/replace p "/" "\\")
(string/replace p "\\" "/"))))
Is it possible to put something like this in fs library?
(str (fs/file path))
On Tue, Apr 7, 2015 at 1:03 PM, Vladislav Bauer [email protected] wrote:
I usually face a problem of incorrect paths or part of paths. To fix this, I use the following workaround:
(defn fix-path [path] (if windows? (string/replace path "/" "\\") (string/replace path "\\" "/")))Is it possible to put something like this in
fslibrary?Reply to this email directly or view it on GitHub: https://github.com/Raynes/fs/issues/91
Thank you for fast response! Documentation fo file function says:
"If `path` is a period, replaces it with cwd and creates a new File object
out of it and `paths`. Or, if the resulting File object does not constitute
an absolute path, makes it absolutely by creating a new File object out of
the `paths` and cwd."
Actually, my path is not path to the real file. It could be just a part of some non-existed path (for example for some configuration needs). I'm not sure that it will help me..