summaryrefslogtreecommitdiff
path: root/win32/vdir.h
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2006-12-28 10:59:40 -0800
committerSteve Hay <SteveHay@planit.com>2007-01-03 17:56:16 +0000
commitaa2b96eccca93a6fe7c95af71c0b4a027561512b (patch)
treeff5fb2fd50f7445230b65a61d28265c94d919226 /win32/vdir.h
parent23175d88b839c4a83ec070928df0fae32557300b (diff)
downloadperl-aa2b96eccca93a6fe7c95af71c0b4a027561512b.tar.gz
[PATCH] Use short pathnames in $^X and @INC if the long form cannot be represented in the current codepage
Date: Thu, 28 Dec 2006 18:59:40 -0800 Message-ID: <vq09p2p09k6rcu6c9t0mab3vnc335ghg9m@4ax.com> Subject: Re: [PATCH] Use short pathnames in $^X and @INC if the long form cannot be represented in the current codepage From: Jan Dubois <jand@ActiveState.com> Date: Wed, 03 Jan 2007 08:12:35 -0800 Message-ID: <orknp2pj17265modfosjkp2qtt4bdgtgjp@4ax.com> p4raw-id: //depot/perl@29675
Diffstat (limited to 'win32/vdir.h')
-rw-r--r--win32/vdir.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/win32/vdir.h b/win32/vdir.h
index fb80e38679..fb93205408 100644
--- a/win32/vdir.h
+++ b/win32/vdir.h
@@ -261,13 +261,13 @@ void VDir::SetDefaultA(char const *pDefault)
int VDir::SetDirW(WCHAR const *pPath, int index)
{
WCHAR chr, *ptr;
- char szBuffer[MAX_PATH+1];
int length = 0;
if (index < driveCount && pPath != NULL) {
length = wcslen(pPath);
pMem->Free(dirTableW[index]);
ptr = dirTableW[index] = (WCHAR*)pMem->Malloc((length+2)*2);
if (ptr != NULL) {
+ char *ansi;
wcscpy(ptr, pPath);
ptr += length-1;
chr = *ptr++;
@@ -275,13 +275,14 @@ int VDir::SetDirW(WCHAR const *pPath, int index)
*ptr++ = '\\';
*ptr = '\0';
}
- WideCharToMultiByte(CP_ACP, 0, dirTableW[index], -1, szBuffer, sizeof(szBuffer), NULL, NULL);
- length = strlen(szBuffer);
+ ansi = win32_ansipath(dirTableW[index]);
+ length = strlen(ansi);
pMem->Free(dirTableA[index]);
dirTableA[index] = (char*)pMem->Malloc(length+1);
if (dirTableA[index] != NULL) {
- strcpy(dirTableA[index], szBuffer);
+ strcpy(dirTableA[index], ansi);
}
+ win32_free(ansi);
}
}