mirror of
https://github.com/python/cpython.git
synced 2024-12-04 07:15:09 +08:00
Remove single "." components from pathnames, and return os.curdir if
the resulting path is empty.
This commit is contained in:
parent
a221b2a7a9
commit
b4cd5c1a3a
@ -82,6 +82,10 @@ def convert_path (pathname):
|
||||
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
||||
|
||||
paths = string.split(pathname, '/')
|
||||
while '.' in paths:
|
||||
paths.remove('.')
|
||||
if not paths:
|
||||
return os.curdir
|
||||
return apply(os.path.join, paths)
|
||||
|
||||
# convert_path ()
|
||||
|
Loading…
Reference in New Issue
Block a user