{
if (InPath[1]==_T(':'))
{
- TCHAR num[2];
INT t=0;
-
- num[1] = _T('\0');
- num[0] = InPath[0];
- _tcslwr(num);
-
+
if ((InPath[0] >= _T('0')) && (InPath[0] <= _T('9')))
{
t = (InPath[0] - _T('0')) +28;
if ((InPath[0] >= _T('a')) && (InPath[0] <= _T('z')))
{
t = (InPath[0] - _T('a')) +1;
+ InPath[0] = t + _T('A') - 1;
+ }
+
+ if ((InPath[0] >= _T('A')) && (InPath[0] <= _T('Z')))
+ {
+ t = (InPath[0] - _T('A')) +1;
}
if (_tgetdcwd(t,OutPath,size) != NULL)
{
TCHAR oldpath[MAX_PATH];
TCHAR OutPath[MAX_PATH];
+ TCHAR OutPathUpper[MAX_PATH];
BOOL fail;
+
/* Get The current directory path and save it */
fail = GetCurrentDirectory(MAX_PATH,oldpath);
if (!fail)
if (_tcsncicmp(&InPath[1],_T(":\\"),2)!=0)
{
- if (!GetRootPath(InPath,OutPath,MAX_PATH))
- _tcscpy(OutPath,InPath);
+ if (!GetRootPath(InPath,OutPathUpper,MAX_PATH))
+ _tcscpy(OutPathUpper,InPath);
}
else
{
- _tcscpy(OutPath,InPath);
+ _tcscpy(OutPathUpper,InPath);
}
+ _tcsupr(OutPathUpper);
+ GetLongPathName(OutPathUpper, OutPath, MAX_PATH);
+
fail = SetCurrentDirectory(OutPath);
if (!fail)
return 1;
+
+
SetCurrentDirectory(OutPath);
GetCurrentDirectory(MAX_PATH,OutPath);
_tchdir(OutPath);
}
ConOutPuts(szCurrent);
return 0;
-
}
/* Get Current Directory */
GetRootPath(_T("."),szCurrent,MAX_PATH);
- /* Remove " */
- if(szPath[0] == _T('\"'))
+ /* Remove " */
+ i = 0;
+ while(i < _tcslen(szPath))
{
- tmpPath = _tcsstr(szPath,_T("\""));
- tmpPath++;
- _tcscpy(szPath,tmpPath);
- }
-
- if(szPath[_tcslen(szPath) - 1] == _T('\"'))
- {
- szPath[_tcslen(szPath) - 1] = _T('\0');
+ if(szPath[i] == _T('\"'))
+ memmove(&szPath[i],&szPath[i + 1], _tcslen(&szPath[i]) * sizeof(TCHAR));
+ else
+ i++;
}
tmpPath = szPath;
return 0;
}
-
+
/* change to full path if relative path was given */
GetFullPathName(szPath,MAX_PATH,szFinalPath,NULL);
szFinalPath[_tcslen(szFinalPath) - 1] = _T('\0');
/* Handle Root Directory Alone*/
- if (_tcslen(szPath) == 3 && szPath[1] == _T(':'))
+ if (_tcslen(szFinalPath) == 3 && szFinalPath[1] == _T(':'))
{
if(!SetRootPath(szFinalPath))
{
else
break;
- _tcscat(szFinalPath,f.cFileName);
-
- if(IsExistingDirectory(szFinalPath))
- {
+ _tcscat(szFinalPath,f.cFileName);
+
+ if ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
+ {
if(!SetRootPath(szFinalPath))
{
/* Change for /D */
if(bChangeDrive)
- SetCurrentDirectory(szFinalPath);
+ {
+ _tcsupr(szFinalPath);
+ GetLongPathName(szFinalPath, szPath, MAX_PATH);
+ SetCurrentDirectory(szPath);
+ }
return 0;
}
+
}
}while(FindNextFile (hFile, &f));