From 0dc5f603e9b86da9fe5798c231d8d6170501516e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 7 Feb 2021 14:01:35 +0100 Subject: patch 8.2.2478: MS-Windows: backup files for plugins are loaded Problem: MS-Windows: backup files for plugins are loaded. Solution: Do not use the alternate file name for files ending in "~". --- src/filepath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/filepath.c') diff --git a/src/filepath.c b/src/filepath.c index 81fe74924..8e54e5bcf 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -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); -- cgit v1.2.1