diff options
author | Guido van Rossum <guido@python.org> | 1997-04-02 06:13:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-04-02 06:13:34 (GMT) |
commit | 228b8e88bc7a7ce740e5c7326697e7c2256e099f (patch) | |
tree | 81149f4696131ea3d2c123fb169c8a31db23a76a /Lib/dos-8x3/posixpat.py | |
parent | d69a84b01eb802b2bfd7dd2c868a9b2da9465a5e (diff) | |
download | cpython-228b8e88bc7a7ce740e5c7326697e7c2256e099f.zip cpython-228b8e88bc7a7ce740e5c7326697e7c2256e099f.tar.gz cpython-228b8e88bc7a7ce740e5c7326697e7c2256e099f.tar.bz2 |
Whole lotta changes.
Diffstat (limited to 'Lib/dos-8x3/posixpat.py')
-rwxr-xr-x | Lib/dos-8x3/posixpat.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/dos-8x3/posixpat.py b/Lib/dos-8x3/posixpat.py index 014dfe2..965184b 100755 --- a/Lib/dos-8x3/posixpat.py +++ b/Lib/dos-8x3/posixpat.py @@ -26,15 +26,20 @@ def isabs(s): return s[:1] == '/' -# Join two pathnames. -# Ignore the first part if the second part is absolute. +# Join pathnames. +# Ignore the previous parts if a part is absolute. # Insert a '/' unless the first part is empty or already ends in '/'. -def join(a, b): - if b[:1] == '/': return b - if a == '' or a[-1:] == '/': return a + b - # Note: join('x', '') returns 'x/'; is this what we want? - return a + '/' + b +def join(a, *p): + path = a + for b in p: + if b[:1] == '/': + path = b + elif path == '' or path[-1:] == '/': + path = path + b + else: + path = path + '/' + b + return path # Split a path in head (everything up to the last '/') and tail (the |