]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove single "." components from pathnames, and return os.curdir if
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 28 Jan 2001 12:23:32 +0000 (12:23 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 28 Jan 2001 12:23:32 +0000 (12:23 +0000)
the resulting path is empty.

Lib/distutils/util.py

index 550d94abb6a75167a67f0042577d7bfcb7ea02ce..d4891b3c2add01ed063b528726e99776ece3f77b 100644 (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 ()