-
Notifications
You must be signed in to change notification settings - Fork 119
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
no path join, or separator? #59
Comments
(fs/file "a" "path" "segment") |
💣 boom. |
Lets 🐛 @amalloy all right now 👯 💃 👯 |
fs/file is not just doing a join. It's also doing cwd operations. I guess I can use io/file. |
Why does that matter? It'll have the same effect as io/file if cwd hasn't changed. On Wed, Sep 18, 2013 at 1:16 PM, acthp notifications@github.com wrote:
|
No, that's incorrect. cavm.cgdata=> (fs/file "one")
#<File /inside/home/craft/cavm/one>
cavm.cgdata=> (io/file "one")
#<File one> |
All it did was make the path absolute to the current working directory which is what would happen later when you need to actually do an operation or something, but fair enough. In any case, io/file and fs/file are the things one is meant to use to do what you want to do. As for the separator bit, if it isn't exposed I'd take a pull request to add it. |
It matters when working with abstract paths, for example when dealing with files that contain references to other files. I'm doing transforms on such files, not actually reading the files they point to. So if there's a relative reference like "../over/there", and it gets changed to an absolute reference on the filesystem, the file is now broken. It's important to be able to normalize paths while doing this, however normalize-path also converts them to absolute references. More worrying, it looks like the underlying java call .getCanonicalFile also does this. I can work around it by prepending root, then removing it. Kinda clumsy. |
I notice there are operations for splitting paths, but none for joining them. Also, the file separator is not exported (seems like it was in the first announcements of this lib?), so callers will have to independently import File to join paths.
The text was updated successfully, but these errors were encountered: