Mercurial > vim
changeset 5578:3881cd916014 v7.4.136
updated for version 7.4.136
Problem: MS-Windows: When saving a file with a UNC path the file becomes
read-only.
Solution: Don't mix up Win32 attributes and Unix attributes. (Ken Takata)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 10 Jan 2014 13:05:20 +0100 |
parents | de28b1568fc2 |
children | c349f9d6fe3d |
files | src/os_mswin.c src/os_win32.c src/version.c |
diffstat | 3 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -617,8 +617,22 @@ vim_stat(const char *name, struct stat * p = buf + strlen(buf); if (p > buf) mb_ptr_back(buf, p); + + /* Remove trailing '\\' except root path. */ if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') *p = NUL; + + if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) + { + /* UNC root path must be followed by '\\'. */ + p = vim_strpbrk(buf + 2, "\\/"); + if (p != NULL) + { + p = vim_strpbrk(p + 1, "\\/"); + if (p == NULL) + STRCAT(buf, "\\"); + } + } #ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage # ifdef __BORLANDC__