[PATCH] CMD: Always keep drive letter uppercase.
Gareth Poole
girpoole at gmail.com
Sat Aug 8 07:39:47 CDT 2020
Windows and DOS before it has always kept the drive letter in uppercase at the command line, regardless of what input it is given. Since paths are case-insensitive this should not affect path resolution, but it is more consistent with bothe behaviour of Windows, and the behaviour that Wine CMD already displays with directory names.
Signed-off-by: Gareth Poole <girpoole at gmail.com>
---
programs/cmd/wcmdmain.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 97cc607a64..5f5f65fe34 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -392,12 +392,20 @@ static void WCMD_show_prompt (BOOL newLine) {
break;
case 'N':
status = GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
+ /* No need to worry about surrogates here, because all possible */
+ /* drive letters are in the BMP. */
+ if (IsCharAlphaW(curdir[0])) { /* Check if the path begins with a drive letter. */
+ curdir[0] = toupper(curdir[0]); /* Ensure that the drive letter is shown in uppercase. */
+ }
if (status) {
*q++ = curdir[0];
}
break;
case 'P':
status = GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
+ if (IsCharAlphaW(curdir[0])) {
+ curdir[0] = toupper(curdir[0]);
+ }
if (status) {
lstrcatW (q, curdir);
while (*q) q++;
@@ -1383,7 +1391,9 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
(!cmd[2] || cmd[2] == ' ' || cmd[2] == '\t')) {
WCHAR envvar[5];
WCHAR dir[MAX_PATH];
-
+ /* Make sure that the working directory is set to the */
+ /* canonical uppercase version of the drive letter. */
+ cmd[0] = toupper(cmd[0]);
/* Ignore potential garbage on the same line */
cmd[2]=0x00;
--
2.27.0
More information about the wine-devel
mailing list