mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Prevent os.path.normpath() from removing current dir. Take 2.
The previous fix didn't take other current dirs and other path separators into consideration, and so it fixed the ‘./’ problem on Linux/Unix but not e.g. ‘.\’ on Windows. In an attempt to be platform agnostic this patch uses os.curdir and os.sep. Fixes upstream #307.
This commit is contained in:
parent
b49d6c958d
commit
1962f40f4a
1 changed files with 3 additions and 2 deletions
|
@ -37,8 +37,9 @@ for ((i=0;i<${{#COMPREPLY[*]}};i++)) do echo ${{COMPREPLY[i]}}; done
|
|||
|
||||
def _normpath(p):
|
||||
# Prevent normpath() from removing initial ‘./’
|
||||
if p.startswith('./'):
|
||||
return './' + os.path.normpath(p[2:])
|
||||
here = os.curdir + os.sep
|
||||
if p.startswith(here):
|
||||
return os.path.join(os.curdir, os.path.normpath(p[len(here):]))
|
||||
return os.path.normpath(p)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue