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

no path join, or separator? #59

Closed
acthp opened this issue Sep 18, 2013 · 8 comments
Closed

no path join, or separator? #59

acthp opened this issue Sep 18, 2013 · 8 comments

Comments

@acthp
Copy link

acthp commented Sep 18, 2013

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.

@Raynes
Copy link
Owner

Raynes commented Sep 18, 2013

(fs/file "a" "path" "segment")

@Raynes Raynes closed this as completed Sep 18, 2013
@bitemyapp
Copy link

💣 boom.

@bitemyapp
Copy link

Lets 🐛 @amalloy all right now 👯 💃 👯

@acthp
Copy link
Author

acthp commented Sep 18, 2013

fs/file is not just doing a join. It's also doing cwd operations. I guess I can use io/file.

@Raynes
Copy link
Owner

Raynes commented Sep 18, 2013

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:

fs/file is not just doing a join. It's also doing cwd operations. I guess I can use io/file.

Reply to this email directly or view it on GitHub:
#59 (comment)

@acthp
Copy link
Author

acthp commented Sep 18, 2013

No, that's incorrect.

cavm.cgdata=> (fs/file "one")
#<File /inside/home/craft/cavm/one>
cavm.cgdata=> (io/file "one")
#<File one>

@Raynes
Copy link
Owner

Raynes commented Sep 18, 2013

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.

@acthp
Copy link
Author

acthp commented Sep 18, 2013

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.

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

3 participants