[Python-checkins] CVS: python/dist/src/Lib ntpath.py,1.38,1.39

Tim Peters tim_one@users.sourceforge.net
Thu, 26 Jul 2001 14:54:39 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv572/python/dist/src/Lib

Modified Files:
	ntpath.py 
Log Message:
Change ntpath.join() so that join("d:/", "/whatever") returns
d:/whatever instead of /whatever.  While I'm afraid changing isabs()
to be *consistent* with this would break lots of code, it makes
best sense for join() to do it this way.  Thanks to Alex Martelli for
pushing back on this one!


Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** ntpath.py	2001/07/20 18:54:44	1.38
--- ntpath.py	2001/07/26 21:54:37	1.39
***************
*** 43,51 ****
      path = a
      for b in p:
!         # If path is a raw drive letter (e.g. "C:"), and b doesn't start
!         # with a drive letter, path+b is correct, and regardless of whether
!         # b is absolute on its own.
!         if len(path) == 2 and path[-1] == ":" and splitdrive(b)[0] == "":
!             pass
  
          # In any other case, if b is absolute it wipes out the path so far.
--- 43,52 ----
      path = a
      for b in p:
!         # If path starts with a raw drive letter (e.g. "C:"), and b doesn't
!         # start with a drive letter, path+b is correct, and regardless of\
!         # whether b is absolute on its own.
!         if len(path) >= 2 and path[1] == ":" and splitdrive(b)[0] == "":
!             if path[-1] in "/\\" and b[:1] in "/\\":
!                 b = b[1:]
  
          # In any other case, if b is absolute it wipes out the path so far.