summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2000-07-16 16:52:45 (GMT)
committerSkip Montanaro <skip@pobox.com>2000-07-16 16:52:45 (GMT)
commita924bb1ad2853bdf24a57bd25a011d5b43fac981 (patch)
treef94575ae791f7c236a4f0e95a11bf0d5ea1f099a
parentfb625847bfc9fb3ebf548b8c32a9accd21868d18 (diff)
downloadcpython-a924bb1ad2853bdf24a57bd25a011d5b43fac981.zip
cpython-a924bb1ad2853bdf24a57bd25a011d5b43fac981.tar.gz
cpython-a924bb1ad2853bdf24a57bd25a011d5b43fac981.tar.bz2
split and join on "/" in commonprefix
-rw-r--r--Lib/posixpath.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 1be5d29..2f7780c 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -120,11 +120,8 @@ def commonprefix(m):
if not m: return ''
n = 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] = n[i].split("/")
+
prefix = n[0]
for item in n:
for i in range(len(prefix)):
@@ -132,7 +129,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.