fix: handle root in join and directory_name - #15
Conversation
lpil
left a comment
There was a problem hiding this comment.
Lovely. Could you update the changelog please 🙏
Previously, `join`ing an empty string with an absolute path (and
vice-versa) would result in a relative path. Now, it returns the
absolute path.
As a side-effect, `directory_name("/")` returns `"/"`, where it used to
return an empty string. This matches the behavior of C's `dirname("/")`
and Erlang's `filename:dirname("/")`.
b92888d to
548b9a8
Compare
|
Added a "v1.1.3" section to the changelog. |
|
Hmmm, I initially wrote this to address lustre-labs/dev-tools#173 but I'm realizing now that this alone isn't enough. We'd need For reference, that's how Erlang's Do you think we should update |
|
Hello! No, it not acceptable for assert is_relative(path1) == is_relative(join(path1, path2))We can potentially add new functions! If you have problems or uses cases please share them so we can figure out what's the best solution. |
Fixes #9.
Previously,
joining an empty string with an absolute path (and vice-versa) would result in a relative path. Now, it returns the absolute path.As a side-effect,
directory_name("/")returns"/", where it used to return an empty string. This matches the behavior of C'sdirname("/")and Erlang'sfilename:dirname("/").