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

Handle base case of directory? #1

Closed
arichiardi opened this issue Feb 16, 2017 · 1 comment
Closed

Handle base case of directory? #1

arichiardi opened this issue Feb 16, 2017 · 1 comment

Comments

@arichiardi
Copy link
Contributor

Hello James, this tiny library here really saved me from the Java purgatory: I was already kind of picturing myself banging my head on the wall while trying to make sense out of Java resources and methods to fetch them when I stumbled across it.

Big thanks.

One thing I have noticed, maybe by design, is that directory? does not handle the case where the input url is nil, which can happen when chaining directly, for example in this sample (cut for brevity):

;; Java resources are the best, how to know if the resource path is a dir?
;; http://stackoverflow.com/questions/20105554/is-there-a-way-to-tell-if-a-classpath-resource-is-a-file-or-a-directory
(->> (str path (when-not (= \/ (last path)) "/")) 
     (.findResource classloader)
     (res/directory? r))

Is it something you would like to add by any chance?

@weavejester
Copy link
Owner

I think that's a good idea. A :default case that just returns false would be a sensible addition, and I'd welcome a PR to that effect.

arichiardi added a commit to arichiardi/resauce that referenced this issue Feb 17, 2017
arichiardi added a commit to arichiardi/resauce that referenced this issue Feb 19, 2017
arichiardi added a commit to arichiardi/resauce that referenced this issue Feb 19, 2017
arichiardi added a commit to arichiardi/resauce that referenced this issue Feb 20, 2017
weavejester added a commit that referenced this issue Feb 20, 2017
Add :default case for directory? (fixes #1)
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