summaryrefslogtreecommitdiff
path: root/win32/vdir.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-10-09 18:41:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-10-09 18:41:40 +0000
commit9afd7f9460d27680225b1fcfc96bc64f179140fc (patch)
tree4fec9af810cb842313753dfc94a2cd069cafa00a /win32/vdir.h
parent32f99636ca70a0114499260dd425570a227647eb (diff)
downloadperl-9afd7f9460d27680225b1fcfc96bc64f179140fc.tar.gz
on Windows, cwd strings in the environment should be of the
form =X:=X:\foo instead of =X=X:\foo\ p4raw-id: //depot/perl@7172
Diffstat (limited to 'win32/vdir.h')
-rw-r--r--win32/vdir.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/win32/vdir.h b/win32/vdir.h
index 0b634a80fc..37cb4a580e 100644
--- a/win32/vdir.h
+++ b/win32/vdir.h
@@ -461,29 +461,37 @@ int VDir::SetCurrentDirectoryA(char *lpBuffer)
}
DWORD VDir::CalculateEnvironmentSpace(void)
-{ /* the current directory environment strings are stored as '=d=d:\path' */
+{ /* the current directory environment strings are stored as '=D:=d:\path' */
int index;
DWORD dwSize = 0;
for (index = 0; index < driveCount; ++index) {
if (dirTableA[index] != NULL) {
- dwSize += strlen(dirTableA[index]) + 4; /* add 1 for trailing NULL and 3 for '=d=' */
+ dwSize += strlen(dirTableA[index]) + 5; /* add 1 for trailing NULL and 4 for '=D:=' */
}
}
return dwSize;
}
LPSTR VDir::BuildEnvironmentSpace(LPSTR lpStr)
-{ /* store the current directory environment strings as '=d=d:\path' */
- int index;
+{ /* store the current directory environment strings as '=D:=d:\path' */
+ int index, length;
LPSTR lpDirStr;
for (index = 0; index < driveCount; ++index) {
lpDirStr = dirTableA[index];
if (lpDirStr != NULL) {
lpStr[0] = '=';
lpStr[1] = lpDirStr[0];
- lpStr[2] = '=';
- strcpy(&lpStr[3], lpDirStr);
- lpStr += strlen(lpDirStr) + 4; /* add 1 for trailing NULL and 3 for '=d=' */
+ lpStr[2] = '\0';
+ CharUpper(&lpStr[1]);
+ lpStr[2] = ':';
+ lpStr[3] = '=';
+ strcpy(&lpStr[4], lpDirStr);
+ length = strlen(lpDirStr);
+ lpStr += length + 5; /* add 1 for trailing NULL and 4 for '=D:=' */
+ if (length > 3 && IsPathSep(lpStr[-2])) {
+ lpStr[-2] = '\0'; /* remove the trailing path separator */
+ --lpStr;
+ }
}
}
return lpStr;