[ros-diffs] [weiden] 27644: Don't strip the trailing backslash if the path is only a drive

weiden at svn.reactos.org weiden at svn.reactos.org
Sat Jul 14 10:01:01 CEST 2007


Author: weiden
Date: Sat Jul 14 12:01:01 2007
New Revision: 27644

URL: http://svn.reactos.org/svn/reactos?rev=27644&view=rev
Log:
Don't strip the trailing backslash if the path is only a drive

Modified:
    trunk/reactos/base/shell/cmd/dir.c

Modified: trunk/reactos/base/shell/cmd/dir.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=27644&r1=27643&r2=27644&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/dir.c (original)
+++ trunk/reactos/base/shell/cmd/dir.c Sat Jul 14 12:01:01 2007
@@ -1523,12 +1523,15 @@
 {
 	TCHAR szMsg[RC_STRING_MAX_SIZE];
 	TCHAR szTemp[MAX_PATH];			/* A buffer to format the directory header */
+	SIZE_T len;
 
 	/* Print directory header */
 	_tcscpy(szTemp, szCurPath);
 
-	/* We cut the trailing \ of the full path */
-	szTemp[_tcslen(szTemp)-1] = _T('\0');
+	/* We cut the trailing \ of the full path, unless the path is a drive */
+	len = _tcslen(szTemp);
+	if ((len != 3 || szTemp[len - 2] != _T(':')) && szTemp[len - 1] == _T('\\'))
+		szTemp[len-1] = _T('\0');
 
 	/* Condition to print header:
 	   We are not printing in bare format




More information about the Ros-diffs mailing list