]> granicus.if.org Git - vim/commitdiff
patch 8.2.2478: MS-Windows: backup files for plugins are loaded v8.2.2478
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Feb 2021 13:01:35 +0000 (14:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Feb 2021 13:01:35 +0000 (14:01 +0100)
Problem:    MS-Windows: backup files for plugins are loaded.
Solution:   Do not use the alternate file name for files ending in "~".

src/filepath.c
src/version.c

index 81fe74924b70fb4d497c18fdca83272e61b2e9f3..8e54e5bcf87c10303c0dcd31d3542ed47bd0203c 100644 (file)
@@ -3360,7 +3360,10 @@ dos_expandpath(
        if (p == NULL)
            break;  // out of memory
 
-       if (*wfb.cAlternateFileName == NUL)
+       // Do not use the alternate filename when the file name ends in '~',
+       // because it picks up backup files: short name for "foo.vim~" is
+       // "foo~1.vim", which matches "*.vim".
+       if (*wfb.cAlternateFileName == NUL || p[STRLEN(p) - 1] == '~')
            p_alt = NULL;
        else
            p_alt = utf16_to_enc(wfb.cAlternateFileName, NULL);
index 7a91c9bae8d5f8a3a35adefa729be545b2c0b422..ae61a32c86f9d235549538c562e3dcf1981846ae 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2478,
 /**/
     2477,
 /**/