nushell/crates/nu-path/src
Hristo Filaretov 7a789d68a2
Don't include trailing separator when expanding tilde (#4974)
* Fix path when expanding tilde

Expanding tilde with no other relative paths would result in:
`$HOME/` instead of `$HOME`. This occurs when users run `cd` with
no extra arguments. In that case, the user's PWD would include the
trailing separator. This does not happen when explicitly passing
a value, such as `cd ~`, because in that case, the path would be
canonicalized.

This happens because std::path::PathBuf::push always adds a separator,
even if adding an empty path, which is what happens when `cd` is
invoked.

* Add test

* Fix test on Windows

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
2022-03-27 06:28:31 +13:00
..
dots.rs Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
expansions.rs Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
helpers.rs Add config file loading 2021-10-13 16:57:05 +13:00
lib.rs Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
tilde.rs Don't include trailing separator when expanding tilde (#4974) 2022-03-27 06:28:31 +13:00
util.rs Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00