[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.169,2.170

Tim Peters python-dev@python.org
Fri, 15 Sep 2000 00:44:52 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv16267

Modified Files:
	posixmodule.c 
Log Message:
Closes SF bug 113894:  on Windows, things like os.listdir("k:") and
glob.glob("k:*py") (i.e., a raw drive letter + colon at the start) were
using the root of the drive rather than the expected Windows behavior
of using the drive's "current directory".


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.169
retrieving revision 2.170
diff -C2 -r2.169 -r2.170
*** posixmodule.c	2000/09/01 23:29:27	2.169
--- posixmodule.c	2000/09/15 07:44:49	2.170
***************
*** 797,800 ****
--- 797,801 ----
  	WIN32_FIND_DATA FileData;
  	char namebuf[MAX_PATH+5];
+ 	char ch;
  
  	if (!PyArg_ParseTuple(args, "t#:listdir", &name, &len))
***************
*** 805,809 ****
  	}
  	strcpy(namebuf, name);
! 	if (namebuf[len-1] != '/' && namebuf[len-1] != '\\')
  		namebuf[len++] = '/';
  	strcpy(namebuf + len, "*.*");
--- 806,811 ----
  	}
  	strcpy(namebuf, name);
! 	ch = namebuf[len-1];
! 	if (ch != '/' && ch != '\\' && ch != ':')
  		namebuf[len++] = '/';
  	strcpy(namebuf + len, "*.*");
***************
*** 845,850 ****
  	return d;
  
! #else /* !MS_WIN32 */
! #ifdef _MSC_VER /* 16-bit Windows */
  
  #ifndef MAX_PATH
--- 847,851 ----
  	return d;
  
! #elif defined(_MSC_VER) /* 16-bit Windows */
  
  #ifndef MAX_PATH
***************
*** 907,912 ****
  	return d;
  
! #else
! #if defined(PYOS_OS2)
  
  #ifndef MAX_PATH
--- 908,912 ----
  	return d;
  
! #elif defined(PYOS_OS2)
  
  #ifndef MAX_PATH
***************
*** 1017,1024 ****
  	return d;
  
! #endif /* !PYOS_OS2 */
! #endif /* !_MSC_VER */
! #endif /* !MS_WIN32 */
! }
  
  static char posix_mkdir__doc__[] =
--- 1017,1022 ----
  	return d;
  
! #endif /* which OS */
! }  /* end of posix_listdir */
  
  static char posix_mkdir__doc__[] =