diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-09-17 01:28:35 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-09-17 01:28:35 -0400 |
commit | a447160a6ca43181158bce8117f2af37f4e9fc85 (patch) | |
tree | fb104bb7b753f26e9927b42f5b7bd39af61240b5 /src/nvim/eval.c | |
parent | 8249e4ac72b54d00addb597a124d0f55566b2466 (diff) | |
parent | 8b3e5829e4902ba214ab3399e97e6a325c625739 (diff) | |
download | rneovim-a447160a6ca43181158bce8117f2af37f4e9fc85.tar.gz rneovim-a447160a6ca43181158bce8117f2af37f4e9fc85.tar.bz2 rneovim-a447160a6ca43181158bce8117f2af37f4e9fc85.zip |
Merge pull request #953 from splinterofchaos/patch235-exepath
vim-patch:7.4.235
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 e750da01f0..760457b54e 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}, @@ -8072,7 +8073,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; } /* @@ -10603,7 +10616,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; |