comparison src/main.c @ 11054:576238eda5a4 v8.0.0416

patch 8.0.0416: setting v:progpath is not quite right commit https://github.com/vim/vim/commit/436631969716e056feca47480976100b70283370 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 5 14:29:12 2017 +0100 patch 8.0.0416: setting v:progpath is not quite right Problem: Setting v:progpath is not quite right. Solution: On MS-Windows add the extension. On Unix use the full path for a relative directory. (partly by James McCoy, closes #1531)
author Christian Brabandt <cb@256bit.org>
date Sun, 05 Mar 2017 14:30:04 +0100
parents fde2cdef6b97
children 354593196e20
comparison
equal deleted inserted replaced
11053:f45fc115b687 11054:576238eda5a4
3531 #if !defined(NO_VIM_MAIN) && defined(FEAT_EVAL) 3531 #if !defined(NO_VIM_MAIN) && defined(FEAT_EVAL)
3532 static void 3532 static void
3533 set_progpath(char_u *argv0) 3533 set_progpath(char_u *argv0)
3534 { 3534 {
3535 char_u *val = argv0; 3535 char_u *val = argv0;
3536 #ifdef WIN32
3537 char_u *path = NULL;
3538 #else
3536 char_u buf[MAXPATHL]; 3539 char_u buf[MAXPATHL];
3540 #endif
3537 3541
3538 /* A relative path containing a "/" will become invalid when using ":cd", 3542 /* A relative path containing a "/" will become invalid when using ":cd",
3539 * turn it into a full path. 3543 * turn it into a full path.
3540 * On MS-Windows "vim.exe" is found in the current directory, thus also do 3544 * On MS-Windows "vim.exe" is found in the current directory, thus also do
3541 * it when there is no path and the file exists. */ 3545 * it when there is no path and the file exists. */
3542 if ( !mch_isFullName(argv0) 3546 if (!mch_isFullName(argv0))
3547 {
3543 # ifdef WIN32 3548 # ifdef WIN32
3544 && mch_can_exe(argv0, NULL, TRUE) 3549 if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
3550 val = path;
3545 # else 3551 # else
3546 && gettail(argv0) != argv0 3552 if (gettail(argv0) != argv0
3547 # endif 3553 && vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
3548 && vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL) 3554 val = buf;
3549 val = buf; 3555 # endif
3556 }
3550 set_vim_var_string(VV_PROGPATH, val, -1); 3557 set_vim_var_string(VV_PROGPATH, val, -1);
3558 #ifdef WIN32
3559 vim_free(path);
3560 #endif
3551 } 3561 }
3552 3562
3553 #endif /* NO_VIM_MAIN */ 3563 #endif /* NO_VIM_MAIN */
3554 3564
3555 #if (defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN)) || defined(PROTO) 3565 #if (defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN)) || defined(PROTO)