diff options
author | Skip Montanaro <skip@pobox.com> | 2000-07-17 03:04:19 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2000-07-17 03:04:19 (GMT) |
commit | 6222c05af6d92c1f5f1569664b22073268ae703a (patch) | |
tree | 3ad4662e99d31b0605d69167b34f36cb6d644d9f /Lib/dospath.py | |
parent | d61591813c5be983a3d7b6812013db441c98292d (diff) | |
download | cpython-6222c05af6d92c1f5f1569664b22073268ae703a.zip cpython-6222c05af6d92c1f5f1569664b22073268ae703a.tar.gz cpython-6222c05af6d92c1f5f1569664b22073268ae703a.tar.bz2 |
* split on / or \
* case insensitive
Diffstat (limited to 'Lib/dospath.py')
-rw-r--r-- | Lib/dospath.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/dospath.py b/Lib/dospath.py index 5a813d0..cb98576 100644 --- a/Lib/dospath.py +++ b/Lib/dospath.py @@ -107,12 +107,9 @@ def dirname(p): def commonprefix(m): "Given a list of pathnames, returns the longest common leading component" if not m: return '' - n = m[:] + n = map(string.lower, m) for i in range(len(n)): - n[i] = n[i].split(os.sep) - # if os.sep didn't have any effect, try os.altsep - if os.altsep and len(n[i]) == 1: - n[i] = n[i].split(os.altsep) + n[i] = re.split(r"[/\\]", n[i]) prefix = n[0] for item in n: @@ -121,7 +118,7 @@ def commonprefix(m): prefix = prefix[:i] if i == 0: return '' break - return os.sep.join(prefix) + return "\\".join(prefix) # Get size, mtime, atime of files. |