summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-05-12 08:23:27 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-05-12 08:23:27 +0000
commit23db2e2d7afc6848cb8a7718eb161f0d24b03858 (patch)
treeee8894d41d7f13a4dacc8b013e26afc2b945fe14 /win32
parente0284a306d2de082f33ef0d8787355c6d4e646d8 (diff)
downloadperl-23db2e2d7afc6848cb8a7718eb161f0d24b03858.tar.gz
opendir(D,"x:") on win32 opens cwd() for drive rather than root;
stat() behaves similarly p4raw-id: //depot/perl@3396
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 4988e31648..ec04823b15 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -682,8 +682,15 @@ win32_opendir(char *filename)
/* Create the search pattern */
strcpy(scanname, filename);
- if (scanname[len-1] != '/' && scanname[len-1] != '\\')
+
+ /* bare drive name means look in cwd for drive */
+ if (len == 2 && isALPHA(scanname[0]) && scanname[1] == ':') {
+ scanname[len++] = '.';
+ scanname[len++] = '/';
+ }
+ else if (scanname[len-1] != '/' && scanname[len-1] != '\\') {
scanname[len++] = '/';
+ }
scanname[len++] = '*';
scanname[len] = '\0';
@@ -929,10 +936,10 @@ win32_stat(const char *path, struct stat *buffer)
t[l] = '\0';
path = t;
break;
- /* FindFirstFile() is buggy with "x:", so add a slash :-( */
+ /* FindFirstFile() is buggy with "x:", so add a dot :-( */
case ':':
if (l == 2 && isALPHA(path[0])) {
- t[0] = path[0]; t[1] = ':'; t[2] = '/'; t[3] = '\0';
+ t[0] = path[0]; t[1] = ':'; t[2] = '.'; t[3] = '\0';
l = 3;
path = t;
}