summaryrefslogtreecommitdiff
path: root/win32/vdir.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-10 18:30:24 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-10 18:30:24 +0000
commitf7aeb604c5566ea382e11775c0d364a41af8fbb9 (patch)
tree864eaacc3657697c21e307642ff50f908c1377e6 /win32/vdir.h
parent3a2f06e93704a4187f4ca10ac210246cacbd9b05 (diff)
downloadperl-f7aeb604c5566ea382e11775c0d364a41af8fbb9.tar.gz
add workaround for textmode read() bug in MSVCRT; make chdir() do
a real SetCurrentDirectory() in toplevel host p4raw-id: //depot/perl@4789
Diffstat (limited to 'win32/vdir.h')
-rw-r--r--win32/vdir.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/win32/vdir.h b/win32/vdir.h
index a8a34e4f12..50822a7aa4 100644
--- a/win32/vdir.h
+++ b/win32/vdir.h
@@ -15,7 +15,7 @@ const int driveCount = 30;
class VDir
{
public:
- VDir();
+ VDir(int bManageDir = 1);
~VDir() {};
void Init(VDir* pDir, VMem *pMem);
@@ -91,7 +91,7 @@ protected:
};
VMem *pMem;
- int nDefault;
+ int nDefault, bManageDirectory;
char *dirTableA[driveCount];
char szLocalBufferA[MAX_PATH+1];
WCHAR *dirTableW[driveCount];
@@ -99,9 +99,10 @@ protected:
};
-VDir::VDir()
+VDir::VDir(int bManageDir /* = 1 */)
{
nDefault = 0;
+ bManageDirectory = bManageDir;
memset(dirTableA, 0, sizeof(dirTableA));
memset(dirTableW, 0, sizeof(dirTableW));
}
@@ -110,6 +111,7 @@ void VDir::Init(VDir* pDir, VMem *p)
{
int index;
DWORD driveBits;
+ int nSave;
char szBuffer[MAX_PATH*driveCount];
pMem = p;
@@ -120,6 +122,8 @@ void VDir::Init(VDir* pDir, VMem *p)
nDefault = pDir->GetDefault();
}
else {
+ nSave = bManageDirectory;
+ bManageDirectory = 0;
driveBits = GetLogicalDrives();
if (GetLogicalDriveStrings(sizeof(szBuffer), szBuffer)) {
char* pEnv = GetEnvironmentStrings();
@@ -133,6 +137,7 @@ void VDir::Init(VDir* pDir, VMem *p)
FreeEnvironmentStrings(pEnv);
}
SetDefaultA(".");
+ bManageDirectory = nSave;
}
}
@@ -163,6 +168,10 @@ int VDir::SetDirA(char const *pPath, int index)
}
}
}
+
+ if(bManageDirectory)
+ ::SetCurrentDirectoryA(pPath);
+
return length;
}
@@ -217,6 +226,10 @@ int VDir::SetDirW(WCHAR const *pPath, int index)
}
}
}
+
+ if(bManageDirectory)
+ ::SetCurrentDirectoryW(pPath);
+
return length;
}