Remove single "." components from pathnames, and return os.curdir if

the resulting path is empty.
This commit is contained in:
Jack Jansen 2001-01-28 12:23:32 +00:00
parent a221b2a7a9
commit b4cd5c1a3a

View File

@ -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 ()