To: vim-dev@vim.org Subject: Patch 6.0.207 (extra) Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.207 (extra) Problem: Win32: The shortcuts and start menu entries let Vim startup in the desktop directory, which is not very useful. Solution: Let shortcuts start Vim in $HOME or $HOMEDIR$HOMEPATH. Files: src/dosinst.c *** ../vim60.206/src/dosinst.c Sun Feb 10 12:57:34 2002 --- src/dosinst.c Sun Feb 10 16:28:26 2002 *************** *** 32,37 **** --- 32,38 ---- directory to write .bat files in */ char *default_vim_dir = NULL; /* when not NULL, use this as the default install dir for NSIS */ + char homedir[BUFSIZE]; /* home directory or "" */ /* * Structure used for each choice the user can make. *************** *** 677,682 **** --- 678,714 ---- fclose(fd); else *oldvimrc = NUL; + + /* + * Get default home directory. + * Prefer $HOME if it's set. For Win NT use $HOMEDRIVE and $HOMEPATH. + * Otherwise, if there is a "c:" drive use that. + */ + p = getenv("HOME"); + if (p != NULL && *p != NUL && strlen(p) < BUFSIZE) + strcpy(homedir, p); + else + { + p = getenv("HOMEDRIVE"); + if (p != NULL && *p != NUL && strlen(p) + 2 < BUFSIZE) + { + strcpy(homedir, p); + p = getenv("HOMEPATH"); + if (p != NULL && *p != NUL && strlen(homedir) + strlen(p) < BUFSIZE) + strcat(homedir, p); + else + strcat(homedir, "\\"); + } + else + { + struct stat st; + + if (stat("c:\\", &st) == 0) + strcpy(homedir, "c:\\"); + else + *homedir = NUL; + } + } } /* *************** *** 1519,1558 **** printf("Creating start menu\n"); if (has_vim) { ! if (build_shortcut("Vim", "vim.exe", "", VIM_STARTMENU, "") == FAIL) return; ! if (build_shortcut("Vim Read-only", "vim.exe", "-R", VIM_STARTMENU, "") ! == FAIL) return; ! if (build_shortcut("Vim Diff", "vim.exe", "-d", VIM_STARTMENU, "") ! == FAIL) return; } if (has_gvim) { ! if (build_shortcut("gVim", "gvim.exe", "", VIM_STARTMENU, "") == FAIL) return; if (build_shortcut("gVim Easy", "gvim.exe", "-y", ! VIM_STARTMENU, "") == FAIL) return; if (build_shortcut("gVim Read-only", "gvim.exe", "-R", ! VIM_STARTMENU, "") == FAIL) return; if (build_shortcut("gVim Diff", "gvim.exe", "-d", ! VIM_STARTMENU, "") == FAIL) return; } if (build_shortcut("Uninstall", ! interactive ? "uninstal.exe" : "uninstall-gui.exe", ! "", VIM_STARTMENU, "") == FAIL) return; /* For Windows NT the working dir of the vimtutor.bat must be right, * otherwise gvim.exe won't be found and using gvimbat doesn't work. */ ! if (build_shortcut("Vim tutor", "vimtutor.bat", "", VIM_STARTMENU, ! installdir) == FAIL) return; if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h", ! VIM_STARTMENU, "") == FAIL) return; { char shell_folder_path[BUFSIZE]; --- 1551,1592 ---- printf("Creating start menu\n"); if (has_vim) { ! if (build_shortcut("Vim", "vim.exe", "", ! VIM_STARTMENU, homedir) == FAIL) return; ! if (build_shortcut("Vim Read-only", "vim.exe", "-R", ! VIM_STARTMENU, homedir) == FAIL) return; ! if (build_shortcut("Vim Diff", "vim.exe", "-d", ! VIM_STARTMENU, homedir) == FAIL) return; } if (has_gvim) { ! if (build_shortcut("gVim", "gvim.exe", "", ! VIM_STARTMENU, homedir) == FAIL) return; if (build_shortcut("gVim Easy", "gvim.exe", "-y", ! VIM_STARTMENU, homedir) == FAIL) return; if (build_shortcut("gVim Read-only", "gvim.exe", "-R", ! VIM_STARTMENU, homedir) == FAIL) return; if (build_shortcut("gVim Diff", "gvim.exe", "-d", ! VIM_STARTMENU, homedir) == FAIL) return; } if (build_shortcut("Uninstall", ! interactive ? "uninstal.exe" : "uninstall-gui.exe", "", ! VIM_STARTMENU, installdir) == FAIL) return; /* For Windows NT the working dir of the vimtutor.bat must be right, * otherwise gvim.exe won't be found and using gvimbat doesn't work. */ ! if (build_shortcut("Vim tutor", "vimtutor.bat", "", ! VIM_STARTMENU, installdir) == FAIL) return; if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h", ! VIM_STARTMENU, homedir) == FAIL) return; { char shell_folder_path[BUFSIZE]; *************** *** 1604,1610 **** /* Create shortcut(s) on the desktop */ if (choices[idx].arg) { ! (void)build_shortcut(icon_names[0], "gvim.exe", "", "desktop", ""); need_uninstall_entry = 1; } } --- 1638,1645 ---- /* Create shortcut(s) on the desktop */ if (choices[idx].arg) { ! (void)build_shortcut(icon_names[0], "gvim.exe", ! "", "desktop", homedir); need_uninstall_entry = 1; } } *************** *** 1614,1620 **** { if (choices[idx].arg) { ! (void)build_shortcut(icon_names[1], "gvim.exe", "-y", "desktop", ""); need_uninstall_entry = 1; } } --- 1649,1656 ---- { if (choices[idx].arg) { ! (void)build_shortcut(icon_names[1], "gvim.exe", ! "-y", "desktop", homedir); need_uninstall_entry = 1; } } *************** *** 1624,1630 **** { if (choices[idx].arg) { ! (void)build_shortcut(icon_names[2], "gvim.exe", "-R", "desktop", ""); need_uninstall_entry = 1; } } --- 1660,1667 ---- { if (choices[idx].arg) { ! (void)build_shortcut(icon_names[2], "gvim.exe", ! "-R", "desktop", homedir); need_uninstall_entry = 1; } } *** ../vim60.206/src/version.c Sun Feb 10 14:27:03 2002 --- src/version.c Sun Feb 10 16:31:14 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 207, /**/ -- ARTHUR: Well, it doesn't matter. Will you go and tell your master that Arthur from the Court of Camelot is here. GUARD #1: Listen, in order to maintain air-speed velocity, a swallow needs to beat its wings 43 times every second, right? ARTHUR: Please! The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///