This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
SYN SYN
[perl5.git] / win32 / vdir.h
index af769f1..2dd7e34 100644 (file)
@@ -452,7 +452,9 @@ int VDir::SetCurrentDirectoryA(char *lpBuffer)
     DWORD r = GetFileAttributesA(pPtr);
     if ((r != 0xffffffff) && (r & FILE_ATTRIBUTE_DIRECTORY))
     {
-       SetDefaultDirA(pPtr, DriveIndex(pPtr[0]));
+       char szBuffer[(MAX_PATH+1)*2];
+       DoGetFullPathNameA(pPtr, sizeof(szBuffer), szBuffer);
+       SetDefaultDirA(szBuffer, DriveIndex(szBuffer[0]));
        nRet = 0;
     }
 
@@ -677,7 +679,9 @@ int VDir::SetCurrentDirectoryW(WCHAR *lpBuffer)
     DWORD r = GetFileAttributesW(pPtr);
     if ((r != 0xffffffff) && (r & FILE_ATTRIBUTE_DIRECTORY))
     {
-       SetDefaultDirW(pPtr, DriveIndex((char)pPtr[0]));
+       WCHAR wBuffer[(MAX_PATH+1)*2];
+       DoGetFullPathNameW(pPtr, (sizeof(wBuffer)/sizeof(WCHAR)), wBuffer);
+       SetDefaultDirW(wBuffer, DriveIndex((char)wBuffer[0]));
        nRet = 0;
     }