1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (win32_stat): WinNT/2k "//host/share" support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2001-03-21 14:12:09 +00:00
parent 7aaceb6d9a
commit 424c3fb43d
2 changed files with 26 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Wed Mar 21 23:07:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* win32/win32.c (win32_stat): WinNT/2k "//host/share" support.
Wed Mar 21 08:05:35 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* win32/dir.h: replace missing/dir.h .

View file

@ -2663,6 +2663,24 @@ myrename(const char *oldpath, const char *newpath)
return res;
}
static int
isUNCRoot(const char *path)
{
if (path[0] == '\\' && path[1] == '\\') {
const char *p;
if (p = strchr(path + 3, '\\')) {
if (!p[1])
return 0;
if (p = strchr(p + 1, '\\')) {
if (!p[1])
return 1;
} else
return 1;
}
}
return 0;
}
int
win32_stat(const char *path, struct stat *st)
{
@ -2681,10 +2699,11 @@ win32_stat(const char *path, struct stat *st)
*s = '\0';
len = strlen(buf1);
p = CharPrev(buf1, buf1 + len);
if (*p == '\\' || *p == ':')
if (isUNCRoot(buf1)) {
if (*p != '\\')
strcat(buf1, "\\");
} else if (*p == '\\' || *p == ':')
strcat(buf1, ".");
else if (buf1[0] == '\\' && buf1[1] == '\\')
strcat(buf1, "\\.");
if (_fullpath(buf2, buf1, MAXPATHLEN))
return stat(buf2, st);
else