0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0273: MS-Windows uninstall may delete wrong batch file

Problem:    MS-Windows uninstall may delete wrong batch file.
Solution:   Add specific marker in the generated batch file. (Ken Takata,
            closes #5654)
This commit is contained in:
Bram Moolenaar 2020-02-17 22:53:14 +01:00
parent 414b796627
commit 1fa8d2c33d
5 changed files with 12 additions and 13 deletions

View File

@ -1359,7 +1359,7 @@ $(VIM): $(VIM).exe
$(OUTDIR): $(OUTDIR):
if not exist $(OUTDIR)/nul mkdir $(OUTDIR) if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
CFLAGS_INST = /nologo -DNDEBUG -DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(CFLAGS_DEPR) CFLAGS_INST = /nologo /O2 -DNDEBUG -DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(CFLAGS_DEPR)
install.exe: dosinst.c dosinst.h version.h install.exe: dosinst.c dosinst.h version.h
$(CC) $(CFLAGS_INST) dosinst.c kernel32.lib shell32.lib \ $(CC) $(CFLAGS_INST) dosinst.c kernel32.lib shell32.lib \

View File

@ -841,6 +841,7 @@ install_bat_choice(int idx)
fprintf(fd, "@echo off\n"); fprintf(fd, "@echo off\n");
fprintf(fd, "rem -- Run Vim --\n"); fprintf(fd, "rem -- Run Vim --\n");
fprintf(fd, VIMBAT_UNINSTKEY "\n");
fprintf(fd, "\n"); fprintf(fd, "\n");
fprintf(fd, "setlocal\n"); fprintf(fd, "setlocal\n");

View File

@ -354,6 +354,9 @@ struct
"vimtutor.bat", "vimtutor.bat", ""}, "vimtutor.bat", "vimtutor.bat", ""},
}; };
/* Uninstall key for vim.bat, etc. */
#define VIMBAT_UNINSTKEY "rem # uninstall key: " VIM_VERSION_NODOT " #"
#define ICON_COUNT 3 #define ICON_COUNT 3
char *(icon_names[ICON_COUNT]) = char *(icon_names[ICON_COUNT]) =
{"gVim " VIM_VERSION_SHORT, {"gVim " VIM_VERSION_SHORT,

View File

@ -200,8 +200,7 @@ batfile_thisversion(char *path)
{ {
FILE *fd; FILE *fd;
char line[BUFSIZE]; char line[BUFSIZE];
char *p; int key_len = strlen(VIMBAT_UNINSTKEY);
int ver_len = strlen(VIM_VERSION_NODOT);
int found = FALSE; int found = FALSE;
fd = fopen(path, "r"); fd = fopen(path, "r");
@ -209,17 +208,11 @@ batfile_thisversion(char *path)
{ {
while (fgets(line, sizeof(line), fd) != NULL) while (fgets(line, sizeof(line), fd) != NULL)
{ {
for (p = line; *p != 0; ++p) if (strncmp(line, VIMBAT_UNINSTKEY, key_len) == 0)
// don't accept "vim60an" when looking for "vim60". {
if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0 found = TRUE;
&& !isdigit(p[ver_len])
&& !isalpha(p[ver_len]))
{
found = TRUE;
break;
}
if (found)
break; break;
}
} }
fclose(fd); fclose(fd);
} }

View File

@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
273,
/**/ /**/
272, 272,
/**/ /**/