From 06c225119d49cea74175424e10adeddf1f57d601 Mon Sep 17 00:00:00 2001 From: Brandon Turner Date: Thu, 25 Aug 2005 17:38:15 +0000 Subject: [PATCH] Use GetShortPathName and GetLongPathName to correct the case of the new path in SetRootPath. GetFullPathName by itself would not work when there was a space in the name. svn path=/trunk/; revision=17541 --- reactos/subsys/system/cmd/internal.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/reactos/subsys/system/cmd/internal.c b/reactos/subsys/system/cmd/internal.c index 32e7777482b..f3c0f6911ee 100644 --- a/reactos/subsys/system/cmd/internal.c +++ b/reactos/subsys/system/cmd/internal.c @@ -215,7 +215,8 @@ BOOL SetRootPath(TCHAR *InPath) { TCHAR oldpath[MAX_PATH]; TCHAR OutPath[MAX_PATH]; - TCHAR OutPathUpper[MAX_PATH]; + TCHAR OutPathTemp[MAX_PATH]; + TCHAR OutPathTemp2[MAX_PATH]; BOOL fail; @@ -228,16 +229,20 @@ BOOL SetRootPath(TCHAR *InPath) if (_tcsncicmp(&InPath[1],_T(":\\"),2)!=0) { - if (!GetRootPath(InPath,OutPathUpper,MAX_PATH)) - _tcscpy(OutPathUpper,InPath); + if (!GetRootPath(InPath,OutPathTemp,MAX_PATH)) + _tcscpy(OutPathTemp,InPath); } else { - _tcscpy(OutPathUpper,InPath); + _tcscpy(OutPathTemp,InPath); } - _tcsupr(OutPathUpper); - GetLongPathName(OutPathUpper, OutPath, MAX_PATH); + _tcsupr(OutPathTemp); + /* The use of both of these together will correct the case of a path + where as one alone or GetFullPath will not. Exameple: + c:\windows\SYSTEM32 => C:\WINDOWS\system32 */ + GetShortPathName(OutPathTemp, OutPathTemp2, MAX_PATH); + GetLongPathName(OutPathTemp2, OutPath, MAX_PATH); fail = SetCurrentDirectory(OutPath); if (!fail) -- 2.17.1