Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Add function to fix paths for different OS #91

Open
vbauer opened this issue Apr 7, 2015 · 2 comments
Open

[Suggestion] Add function to fix paths for different OS #91

vbauer opened this issue Apr 7, 2015 · 2 comments

Comments

@vbauer
Copy link

vbauer commented Apr 7, 2015

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?

@Raynes
Copy link
Owner

Raynes commented Apr 7, 2015

(str (fs/file path))

On Tue, Apr 7, 2015 at 1:03 PM, Vladislav Bauer notifications@github.com
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 fs library?

Reply to this email directly or view it on GitHub:
#91

@vbauer
Copy link
Author

vbauer commented Apr 7, 2015

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants