mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00: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
1 changed files with 4 additions and 0 deletions
|
|
@ -82,6 +82,10 @@ def convert_path (pathname):
|
||||||
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
||||||
|
|
||||||
paths = string.split(pathname, '/')
|
paths = string.split(pathname, '/')
|
||||||
|
while '.' in paths:
|
||||||
|
paths.remove('.')
|
||||||
|
if not paths:
|
||||||
|
return os.curdir
|
||||||
return apply(os.path.join, paths)
|
return apply(os.path.join, paths)
|
||||||
|
|
||||||
# convert_path ()
|
# convert_path ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue