summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-10-13 20:37:41 +0200
committerBram Moolenaar <Bram@vim.org>2010-10-13 20:37:41 +0200
commit464c92545ac15ebb481d3fde683d6b147a527814 (patch)
treefbf8456f1257f344906beb1b184c816600ce062c /src/os_win32.c
parent77a0aa457d66d6dd06435bdd2dd9d53e704e1373 (diff)
downloadvim-464c92545ac15ebb481d3fde683d6b147a527814.zip
updated for version 7.3.027
Problem: Opening a file on a network share is very slow. Solution: When fixing file name case append "\*" to directory, server and network share names. (David Anderson, John Beckett)
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 8c59e0996..6bfcc2af5 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2308,12 +2308,14 @@ fname_case(
int len)
{
char szTrueName[_MAX_PATH + 2];
+ char szTrueNameTemp[_MAX_PATH + 2];
char *ptrue, *ptruePrev;
char *porig, *porigPrev;
int flen;
WIN32_FIND_DATA fb;
HANDLE hFind;
int c;
+ int slen;
flen = (int)STRLEN(name);
if (flen == 0 || flen > _MAX_PATH)
@@ -2358,12 +2360,19 @@ fname_case(
}
*ptrue = NUL;
+ /* To avoid a slow failure append "\*" when searching a directory,
+ * server or network share. */
+ STRCPY(szTrueNameTemp, szTrueName);
+ slen = strlen(szTrueNameTemp);
+ if (*porig == psepc && slen + 2 < _MAX_PATH)
+ STRCPY(szTrueNameTemp + slen, "\\*");
+
/* Skip "", "." and "..". */
if (ptrue > ptruePrev
&& (ptruePrev[0] != '.'
|| (ptruePrev[1] != NUL
&& (ptruePrev[1] != '.' || ptruePrev[2] != NUL)))
- && (hFind = FindFirstFile(szTrueName, &fb))
+ && (hFind = FindFirstFile(szTrueNameTemp, &fb))
!= INVALID_HANDLE_VALUE)
{
c = *porig;