comparison src/dosinst.c @ 19762:b97112a4e3e4 v8.2.0437

patch 8.2.0437: MS-Windows installer contains old stuff Commit: https://github.com/vim/vim/commit/0df541963d406edd69d3ebe8de3912eb87b05414 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 23 22:17:11 2020 +0100 patch 8.2.0437: MS-Windows installer contains old stuff Problem: MS-Windows installer contains old stuff. Solution: Rely on Windows NT. (Ken Takata, closes https://github.com/vim/vim/issues/5832)
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Mar 2020 22:30:03 +0100
parents 9800e126eaa2
children 7334bf933510
comparison
equal deleted inserted replaced
19761:635c86919ed2 19762:b97112a4e3e4
845 fprintf(fd, "\n"); 845 fprintf(fd, "\n");
846 fprintf(fd, "setlocal\n"); 846 fprintf(fd, "setlocal\n");
847 847
848 /* 848 /*
849 * Don't use double quotes for the "set" argument, also when it 849 * Don't use double quotes for the "set" argument, also when it
850 * contains a space. The quotes would be included in the value 850 * contains a space. The quotes would be included in the value.
851 * for MSDOS and NT.
852 * The order of preference is: 851 * The order of preference is:
853 * 1. $VIMRUNTIME/vim.exe (user preference) 852 * 1. $VIMRUNTIME/vim.exe (user preference)
854 * 2. $VIM/vim81/vim.exe (hard coded version) 853 * 2. $VIM/vim81/vim.exe (hard coded version)
855 * 3. installdir/vim.exe (hard coded install directory) 854 * 3. installdir/vim.exe (hard coded install directory)
856 */ 855 */
859 VIM_VERSION_NODOT, exename, VIM_VERSION_NODOT); 858 VIM_VERSION_NODOT, exename, VIM_VERSION_NODOT);
860 fprintf(fd, "if exist \"%%VIMRUNTIME%%\\%s\" set VIM_EXE_DIR=%%VIMRUNTIME%%\n", exename); 859 fprintf(fd, "if exist \"%%VIMRUNTIME%%\\%s\" set VIM_EXE_DIR=%%VIMRUNTIME%%\n", exename);
861 fprintf(fd, "\n"); 860 fprintf(fd, "\n");
862 861
863 // Give an error message when the executable could not be found. 862 // Give an error message when the executable could not be found.
864 fprintf(fd, "if exist \"%%VIM_EXE_DIR%%\\%s\" goto havevim\n", 863 fprintf(fd, "if not exist \"%%VIM_EXE_DIR%%\\%s\" (\n", exename);
865 exename); 864 fprintf(fd, " echo \"%%VIM_EXE_DIR%%\\%s\" not found\n", exename);
866 fprintf(fd, "echo \"%%VIM_EXE_DIR%%\\%s\" not found\n", exename); 865 fprintf(fd, " goto :eof\n");
867 fprintf(fd, "goto eof\n"); 866 fprintf(fd, ")\n");
868 fprintf(fd, "\n"); 867 fprintf(fd, "\n");
869 fprintf(fd, ":havevim\n"); 868
870
871 fprintf(fd, "rem collect the arguments in VIMARGS for Win95\n");
872 fprintf(fd, "set VIMARGS=\n");
873 if (*exename == 'g')
874 fprintf(fd, "set VIMNOFORK=\n");
875 fprintf(fd, ":loopstart\n");
876 fprintf(fd, "if .%%1==. goto loopend\n");
877 if (*exename == 'g') 869 if (*exename == 'g')
878 { 870 {
879 fprintf(fd, "if NOT .%%1==.--nofork goto noforklongarg\n"); 871 fprintf(fd, "rem check --nofork argument\n");
880 fprintf(fd, "set VIMNOFORK=1\n"); 872 fprintf(fd, "set VIMNOFORK=\n");
881 fprintf(fd, ":noforklongarg\n"); 873 fprintf(fd, ":loopstart\n");
882 fprintf(fd, "if NOT .%%1==.-f goto noforkarg\n"); 874 fprintf(fd, "if .%%1==. goto loopend\n");
883 fprintf(fd, "set VIMNOFORK=1\n"); 875 fprintf(fd, "if .%%1==.--nofork (\n");
884 fprintf(fd, ":noforkarg\n"); 876 fprintf(fd, " set VIMNOFORK=1\n");
877 fprintf(fd, ") else if .%%1==.-f (\n");
878 fprintf(fd, " set VIMNOFORK=1\n");
879 fprintf(fd, ")\n");
880 fprintf(fd, "shift\n");
881 fprintf(fd, "goto loopstart\n");
882 fprintf(fd, ":loopend\n");
883 fprintf(fd, "\n");
885 } 884 }
886 fprintf(fd, "set VIMARGS=%%VIMARGS%% %%1\n"); 885
887 fprintf(fd, "shift\n");
888 fprintf(fd, "goto loopstart\n");
889 fprintf(fd, ":loopend\n");
890 fprintf(fd, "\n");
891
892 fprintf(fd, "if .%%OS%%==.Windows_NT goto ntaction\n");
893 fprintf(fd, "\n");
894
895 // For gvim.exe use "start" to avoid that the console window stays
896 // open.
897 if (*exename == 'g') 886 if (*exename == 'g')
898 { 887 {
899 fprintf(fd, "if .%%VIMNOFORK%%==.1 goto nofork\n"); 888 // For gvim.exe use "start /b" to avoid that the console window
900 fprintf(fd, "start "); 889 // stays open.
890 fprintf(fd, "if .%%VIMNOFORK%%==.1 (\n");
891 fprintf(fd, " start \"dummy\" /b /wait ");
892 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
893 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n",
894 exename, vimarg);
895 fprintf(fd, ") else (\n");
896 fprintf(fd, " start \"dummy\" /b ");
897 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
898 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n",
899 exename, vimarg);
900 fprintf(fd, ")\n");
901 } 901 }
902 902 else
903 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
904 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%VIMARGS%%\n",
905 exename, vimarg);
906 fprintf(fd, "goto eof\n");
907 fprintf(fd, "\n");
908
909 if (*exename == 'g')
910 { 903 {
911 fprintf(fd, ":nofork\n");
912 fprintf(fd, "start /w ");
913 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
914 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%VIMARGS%%\n",
915 exename, vimarg);
916 fprintf(fd, "goto eof\n");
917 fprintf(fd, "\n");
918 }
919
920 fprintf(fd, ":ntaction\n");
921 fprintf(fd, "rem for WinNT we can use %%*\n");
922
923 // For gvim.exe use "start /b" to avoid that the console window
924 // stays open.
925 if (*exename == 'g')
926 {
927 fprintf(fd, "if .%%VIMNOFORK%%==.1 goto noforknt\n");
928 fprintf(fd, "start \"dummy\" /b ");
929 }
930
931 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
932 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", exename, vimarg);
933 fprintf(fd, "goto eof\n");
934 fprintf(fd, "\n");
935
936 if (*exename == 'g')
937 {
938 fprintf(fd, ":noforknt\n");
939 fprintf(fd, "start \"dummy\" /b /wait ");
940 // Always use quotes, $VIM or $VIMRUNTIME might have a space. 904 // Always use quotes, $VIM or $VIMRUNTIME might have a space.
941 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", 905 fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n",
942 exename, vimarg); 906 exename, vimarg);
943 } 907 }
944
945 fprintf(fd, "\n:eof\n");
946 fprintf(fd, "set VIMARGS=\n");
947 if (*exename == 'g')
948 fprintf(fd, "set VIMNOFORK=\n");
949 908
950 fclose(fd); 909 fclose(fd);
951 printf("%s has been %s\n", batpath, 910 printf("%s has been %s\n", batpath,
952 oldname == NULL ? "created" : "overwritten"); 911 oldname == NULL ? "created" : "overwritten");
953 } 912 }