diff options
| author | Scott Prager <splinterofchaos@gmail.com> | 2014-09-17 00:58:30 -0400 | 
|---|---|---|
| committer | Scott Prager <splinterofchaos@gmail.com> | 2014-09-17 01:00:24 -0400 | 
| commit | 9445eaa297a7e01c20cb5e5141be54cc7d8d5cce (patch) | |
| tree | cb44a949bab57286b4cda4aee8843b39bdef5b12 /src/nvim/eval.c | |
| parent | 899878d347b4a85e3a19e5bb86f7519cc9255992 (diff) | |
| download | rneovim-9445eaa297a7e01c20cb5e5141be54cc7d8d5cce.tar.gz rneovim-9445eaa297a7e01c20cb5e5141be54cc7d8d5cce.tar.bz2 rneovim-9445eaa297a7e01c20cb5e5141be54cc7d8d5cce.zip  | |
vim-patch:7.4.235
Problem:    It is not easy to get the full path of a command.
Solution:   Add the exepath() function.
https://code.google.com/p/vim/source/detail?r=5ab2946f7ce560985830fbc3c453bb0f7a01f385
Diffstat (limited to 'src/nvim/eval.c')
| -rw-r--r-- | src/nvim/eval.c | 17 | 
1 files changed, 15 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7793f5040c..8ced879880 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6355,6 +6355,7 @@ static struct fst {    {"eval",            1, 1, f_eval},    {"eventhandler",    0, 0, f_eventhandler},    {"executable",      1, 1, f_executable}, +  {"exepath",         1, 1, f_exepath},    {"exists",          1, 1, f_exists},    {"exp",             1, 1, f_exp},    {"expand",          1, 3, f_expand}, @@ -8066,7 +8067,19 @@ static void f_eventhandler(typval_T *argvars, typval_T *rettv)   */  static void f_executable(typval_T *argvars, typval_T *rettv)  { -  rettv->vval.v_number = os_can_exe(get_tv_string(&argvars[0])); +  rettv->vval.v_number = os_can_exe(get_tv_string(&argvars[0]), NULL); +} + +/// "exepath()" function +static void f_exepath(typval_T *argvars, typval_T *rettv) +{ +  char_u *arg = get_tv_string(&argvars[0]); +  char_u *path = NULL; + +  (void)os_can_exe(arg, &path); + +  rettv->v_type = VAR_STRING; +  rettv->vval.v_string = path;  }  /* @@ -10577,7 +10590,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv)      }    } -  if (!os_can_exe(get_tv_string(&argvars[1]))) { +  if (!os_can_exe(get_tv_string(&argvars[1]), NULL)) {      // String is not executable      EMSG2(e_jobexe, get_tv_string(&argvars[1]));      return;  | 
