diff options
author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-21 14:12:09 +0000 |
---|---|---|
committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-21 14:12:09 +0000 |
commit | 2f9d8f4b6bce0faf70b659df7726b68a12005972 (patch) | |
tree | 2840975041e88667cf990f2bd0d81177d559fde2 /win32 | |
parent | 073982a0fcfa76e444ce374437b05b1bcf5831d6 (diff) |
* win32/win32.c (win32_stat): WinNT/2k "//host/share" support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 14b4aeb9f0..828d932b13 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2594,6 +2594,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) { @@ -2612,10 +2630,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 |