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 | 90c6fbcf060c33549c97d530d145208d7d013592 (patch) | |
tree | 11585e5292d1e53f6e9df3ebb976f2df61a1ac56 /win32/win32.c | |
parent | 1dc187021f8bfcbb83bd95a1b0317c9ab2c6f023 (diff) | |
download | ruby-90c6fbcf060c33549c97d530d145208d7d013592.tar.gz ruby-90c6fbcf060c33549c97d530d145208d7d013592.tar.xz ruby-90c6fbcf060c33549c97d530d145208d7d013592.zip |
* win32/win32.c (win32_stat): WinNT/2k "//host/share" support.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-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 6f16d4ad0..55e863be9 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -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 |