Raynes / fs

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

Fix touch, add hidden?, link?, link, and sym-link functions #54

Closed noprompt closed 11 years ago

noprompt commented 11 years ago

I realize this is a bit of small package but I ended up spotting the touch "bug" when I tried

user=> (hidden? (touch ".hidden"))
;; IllegalArgumentException No implementation of method: :as-file of protocol:
;; #'clojure.java.io/Coercions found for class: 
;; me.raynes.fs$file  clojure.core/-cache-protocol-fn (core_deftype.clj:527)

and discovered it was returning #<fs$file me.raynes.fs$file@292f93ae> while testing hidden?.

I've added link and sym-link for creating "hard" and "soft" links as well as a link? function which partly closes #48. I say partly because I think the person was also asking if fs/walk could have the option to (not) follow links but I think that's a separate issue.

Raynes commented 11 years ago

What is the 'touch bug' that you're talking about?

noprompt commented 11 years ago

Touch was returning the fs/file function instead of the file result.

noprompt commented 11 years ago

See here

amalloy commented 11 years ago

Doesn't this pull request make fs stop working on Java versions below 7?

Raynes commented 11 years ago

Yes. Do we still run Java 6 somewhere?

amalloy commented 11 years ago

Does that matter? Clojure supports 1.6, which has a wider install base than 1.7 last I checked, so this breaks fs for over half its users. On Jun 2, 2013 1:28 PM, "Anthony Grimes" notifications@github.com wrote:

Yes. Do we still run Java 6 somewhere?

— Reply to this email directly or view it on GitHubhttps://github.com/Raynes/fs/pull/54#issuecomment-18812137 .

Raynes commented 11 years ago

Yes, it matters to me. I don't care very much. Most people probably haven't updated fs in 20 versions, and Java 7 has a ton of stuff that can make fs better.

If @noprompt wants to add code to make his changes only if java.nio exists, then I've got no problem with that.

amalloy commented 11 years ago

Makes sense to me, as long as you do it on purpose and note it on the README. On Jun 2, 2013 1:37 PM, "Anthony Grimes" notifications@github.com wrote:

Yes, it matters to me. I don't care very much. Most people probably haven't updated fs in 20 versions, and Java 7 has a ton of stuff that can make fs better.

If @noprompt https://github.com/noprompt wants to add code to make his changes only if java.nio exists, then I've got no problem with that.

— Reply to this email directly or view it on GitHubhttps://github.com/Raynes/fs/pull/54#issuecomment-18812295 .

Raynes commented 11 years ago

Agreed. I want to see what @noprompt thinks first, because he may very well have not done this on purpose and I didn't mention it when we were talking last night.

noprompt commented 11 years ago

Breaking compatibility for that many users is definitely not something I'd like to do. I can make the patch this evening.