Mercurial > vim
comparison src/os_mswin.c @ 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 | c0e3990aed3f |
children | bcf25cc08236 |
comparison
equal
deleted
inserted
replaced
5577:de28b1568fc2 | 5578:3881cd916014 |
---|---|
615 | 615 |
616 vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); | 616 vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); |
617 p = buf + strlen(buf); | 617 p = buf + strlen(buf); |
618 if (p > buf) | 618 if (p > buf) |
619 mb_ptr_back(buf, p); | 619 mb_ptr_back(buf, p); |
620 | |
621 /* Remove trailing '\\' except root path. */ | |
620 if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') | 622 if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') |
621 *p = NUL; | 623 *p = NUL; |
624 | |
625 if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) | |
626 { | |
627 /* UNC root path must be followed by '\\'. */ | |
628 p = vim_strpbrk(buf + 2, "\\/"); | |
629 if (p != NULL) | |
630 { | |
631 p = vim_strpbrk(p + 1, "\\/"); | |
632 if (p == NULL) | |
633 STRCAT(buf, "\\"); | |
634 } | |
635 } | |
622 #ifdef FEAT_MBYTE | 636 #ifdef FEAT_MBYTE |
623 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage | 637 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage |
624 # ifdef __BORLANDC__ | 638 # ifdef __BORLANDC__ |
625 /* Wide functions of Borland C 5.5 do not work on Windows 98. */ | 639 /* Wide functions of Borland C 5.5 do not work on Windows 98. */ |
626 && g_PlatformId == VER_PLATFORM_WIN32_NT | 640 && g_PlatformId == VER_PLATFORM_WIN32_NT |