Skip to content

fix: handle root in join and directory_name - #15

Open
JackoCoolio wants to merge 1 commit into
lpil:mainfrom
JackoCoolio:fix/join-with-root
Open

fix: handle root in join and directory_name#15
JackoCoolio wants to merge 1 commit into
lpil:mainfrom
JackoCoolio:fix/join-with-root

Conversation

@JackoCoolio

Copy link
Copy Markdown

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's dirname("/") and Erlang's filename:dirname("/").

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("/")`.

@lpil lpil left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely. Could you update the changelog please 🙏

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

Successfully merging this pull request may close these issues.

Unexpected behavior for filepath.join("/","one")

2 participants