To: vim-dev@vim.org Subject: Patch 5.6.008 (extra) Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.008 (extra) Problem: Win32: When two files exist with the same name but different case (through NFS or Samba), fixing the file name case could cause the wrong one to be edited. Solution: Prefer a perfect match above a match while ignoring case in fname_case(). (Flemming Madsen) Files: src/os_win32.c *** ../vim-5.6.7/src/os_win32.c Thu Jan 13 22:49:23 2000 --- src/os_win32.c Fri Jan 21 15:15:21 2000 *************** *** 1528,1533 **** --- 1528,1534 ---- char_u *name) { char szTrueName[_MAX_PATH + 2]; + char szOrigElem[_MAX_PATH + 2]; char *psz, *pszPrev; const int len = (name != NULL) ? STRLEN(name) : 0; *************** *** 1562,1568 **** --- 1563,1581 ---- { /* avoid ".." and ".", etc */ if (_stricoll(pszPrev, fb.cFileName) == 0) + { + STRCPY(szOrigElem, pszPrev); STRCPY(pszPrev, fb.cFileName); + /* Look for exact match and prefer it if found */ + while (FindNextFile(hFind, &fb)) + { + if (strcoll(szOrigElem, fb.cFileName) == 0) + { + STRCPY(pszPrev, fb.cFileName); + break; + } + } + } FindClose(hFind); } *** ../vim-5.6.7/src/version.c Mon Jan 24 13:09:41 2000 --- src/version.c Mon Jan 24 13:09:18 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 8, /**/ -- GUARD #1: What -- a swallow carrying a coconut? ARTHUR: It could grip it by the husk! GUARD #1: It's not a question of where he grips it! It's a simple question of weight ratios! A five ounce bird could not carry a 1 pound coconut. The Quest for the Holy Grail (Monty Python) /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /