From e805d34b4d788645f85cfd712fe7dff6405896b3 Mon Sep 17 00:00:00 2001 From: Patrick Fasano Date: Wed, 23 Sep 2020 16:56:12 -0400 Subject: [PATCH] cwd: Fix home indicator when HOME contains a symlink --- powerline_shell/segments/cwd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/powerline_shell/segments/cwd.py b/powerline_shell/segments/cwd.py index a7023178..7a233590 100644 --- a/powerline_shell/segments/cwd.py +++ b/powerline_shell/segments/cwd.py @@ -6,9 +6,10 @@ def replace_home_dir(cwd): + realcwd = os.path.realpath(cwd) home = os.path.realpath(os.getenv('HOME')) - if cwd.startswith(home): - return '~' + cwd[len(home):] + if realcwd.startswith(home): + return '~' + realcwd[len(home):] return cwd