summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index a621e459..ddc3945b 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1141,7 +1141,11 @@ class Cmd(cmd.Cmd):
# Remove cwd if it was added to match the text readline expects
if cwd_added:
- matches = [cur_path.replace(cwd + os.path.sep, '', 1) for cur_path in matches]
+ if cwd == os.path.sep:
+ to_replace = cwd
+ else:
+ to_replace = cwd + os.path.sep
+ matches = [cur_path.replace(to_replace, '', 1) for cur_path in matches]
# Restore the tilde string if we expanded one to match the text readline expects
if expanded_tilde_path: