From d6b6b1df38898d247ab238fa23b70609d4a4506f Mon Sep 17 00:00:00 2001 From: VincentWo Date: Sun, 30 Aug 2020 19:24:38 +0200 Subject: [PATCH] Changing the directory to '.' doesn't modify the prompt anymore (#2457) Doing 'cd .' or an equal command used to modify the prompt: It appended an './' and was even repeatable, leading to strange prompts (believe me, I tested it for too long). This fixes #2432 --- crates/nu-cli/src/path.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/path.rs b/crates/nu-cli/src/path.rs index 892ce8aab1..d7d4df8f80 100644 --- a/crates/nu-cli/src/path.rs +++ b/crates/nu-cli/src/path.rs @@ -6,7 +6,14 @@ where P: AsRef, Q: AsRef, { - let path = relative_to.as_ref().join(path); + let path = if path.as_ref() == Path::new(".") { + // Joining a Path with '.' appends a '.' at the end, making the prompt + // more ugly - so we don't do anything, which should result in an equal + // path on all supported systems. + relative_to.as_ref().to_owned() + } else { + relative_to.as_ref().join(path) + }; let (relative_to, path) = { let components: Vec<_> = path.components().collect();