mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
modify twiddle replacement only to happen at the start of the path
This commit is contained in:
parent
e88eb8c98d
commit
4cdacc0fea
1 changed files with 8 additions and 4 deletions
|
@ -528,14 +528,18 @@ def _replace_home(x):
|
|||
if ON_WINDOWS:
|
||||
home = (builtins.__xonsh_env__['HOMEDRIVE'] +
|
||||
builtins.__xonsh_env__['HOMEPATH'][0])
|
||||
cwd = x.replace(home, '~')
|
||||
if x.startswith(home):
|
||||
x = x.replace(home, '~', 1)
|
||||
|
||||
if builtins.__xonsh_env__.get('FORCE_POSIX_PATHS'):
|
||||
cwd = cwd.replace(os.sep, os.altsep)
|
||||
x = x.replace(os.sep, os.altsep)
|
||||
|
||||
return cwd
|
||||
return x
|
||||
else:
|
||||
return x.replace(builtins.__xonsh_env__['HOME'], '~')
|
||||
home = builtins.__xonsh_env__['HOME']
|
||||
if x.startswith(home):
|
||||
x = x.replace(home, '~', 1)
|
||||
return x
|
||||
|
||||
_replace_home_cwd = lambda: _replace_home(builtins.__xonsh_env__['PWD'])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue