Raynes / fs

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

make home work properly #12

Open Raynes opened 12 years ago

Raynes commented 12 years ago

https://github.com/Raynes/fs/commit/1b5e18ee9bc83a5bcaaddbf7f9667834b0cf7f87#commitcomment-796025

Blah. This can be fixed, but boy will it be ugly.

Raynes commented 12 years ago

Bandaid on the wound. I made it so that the path expansion stuff is explicit. We really do need to fix home though (which would fix path expansion as a side effect).

xpe commented 9 years ago

@Raynes Does this problem remain? Perhaps it would help to add a small number of examples to reproduce the problems? (I'm about to start digging into ~ expansion with Java interop, so I can lend another set of eyes.)

Raynes commented 9 years ago

Yes. I'm not sure what I could add as an example. The problem is that fs doesn't actually know where ~<user> leads, because it doesn't necessarily have to be /home/<user>.

xpe commented 9 years ago

@Raynes I don't see any examples. When I dig through the link above, I don't see a clear statement of the problem.

Now, at the risk of having no clarity on what the actual problem is, why is this hard? Why not just lookup the $HOME environment variable and convert ~ to it?

Raynes commented 9 years ago

Please read the linked thread. The problem is clearly defined.

~<user>/foo

We don't currently have a way to tell where 's home directory actually is. $HOME is not remotely cross platform, let alone even reliably set in every environment. Not sure how much more I can explain :P

Raynes commented 9 years ago

It's not necessarily hard either, I just haven't bothered.

xpe commented 9 years ago

System.getProperty("user.home") works most of the time according to http://stackoverflow.com/questions/585534. Surely there is a respectable Java library that has already solved this?

Correction: System.getProperty("user.home") not $HOME.

Raynes commented 9 years ago

Fantastic question. Is there?