modify _collapsed_pwd to use tools.get_sep

This commit is contained in:
adam j hartz 2015-12-06 13:55:02 -05:00
parent 3c9a173553
commit 92985818b5

View file

@ -19,7 +19,7 @@ from xonsh.tools import (
env_path_to_str, is_bool, to_bool, bool_to_str, is_history_tuple, to_history_tuple,
history_tuple_to_str, is_float, string_types, is_string, DEFAULT_ENCODING,
is_completions_display_value, to_completions_display_value, is_string_set,
csv_to_set, set_to_csv
csv_to_set, set_to_csv, get_sep
)
from xonsh.dirstack import _get_cwd
from xonsh.foreign_shells import DEFAULT_SHELLS, load_foreign_envs
@ -98,7 +98,7 @@ else:
DEFAULT_PROMPT = ('{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} '
'{cwd}{branch_color}{curr_branch} '
'{BOLD_BLUE}{prompt_end}{NO_COLOR} ')
DEFAULT_TITLE = '{user}@{hostname}: {cwd} | xonsh'
@default_value
@ -554,9 +554,7 @@ def _replace_home(x):
_replace_home_cwd = lambda: _replace_home(builtins.__xonsh_env__['PWD'])
def _collapsed_pwd():
sep = os.sep
if ON_WINDOWS and builtins.__xonsh_env__.get('FORCE_POSIX_PATHS'):
sep = os.altsep
sep = get_sep()
pwd = _replace_home_cwd().split(sep)
l = len(pwd)
leader = sep if l>0 and len(pwd[0])==0 else ''