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

comment inconsistent: fs/parent returns file no matter if it exist or not #110

Closed
jeroenvandijk opened this issue Aug 4, 2023 · 0 comments

Comments

@jeroenvandijk
Copy link

jeroenvandijk commented Aug 4, 2023

(Tested with babashka/fs {:mvn/version "0.4.19"})

Comment says: Returns parent of f, is it exists. Akin to dirname in bash. (source)

Except for the typo, "if it exists" is not correct:

E.g.

(def f (fs/file "a/b/c"))
(fs/exists? f) ;=> false
(fs/parent (fs/file f)) ;=> (fs/file "a/b")
(fs/exists? (fs/parent (fs/file f))) ;=> false

This is consistent with java.io.file behaviour though:

(.getParentFile (java.io.File. "non-existent/dir/foo")) ;=> (java.io.File. "non-existent/dir")
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

1 participant