Mercurial > vim
diff src/filepath.c @ 28629:5ef46b938c6e v8.2.4838
patch 8.2.4838: checking for absolute path is not trivial
Commit: https://github.com/vim/vim/commit/dca1d40cd0f2af0755519e7028378bd3c8fefd31
Author: LemonBoy <thatlemon@gmail.com>
Date: Thu Apr 28 15:26:33 2022 +0100
patch 8.2.4838: checking for absolute path is not trivial
Problem: Checking for absolute path is not trivial.
Solution: Add isabsolutepath(). (closes https://github.com/vim/vim/issues/10303)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Apr 2022 16:30:03 +0200 |
parents | 62cc3b60493b |
children | dfe18756f2ad |
line wrap: on
line diff
--- a/src/filepath.c +++ b/src/filepath.c @@ -1417,6 +1417,18 @@ f_isdirectory(typval_T *argvars, typval_ } /* + * "isabsolutepath()" function + */ + void +f_isabsolutepath(typval_T *argvars, typval_T *rettv) +{ + if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + return; + + rettv->vval.v_number = mch_isFullName(tv_get_string_strict(&argvars[0])); +} + +/* * Create the directory in which "dir" is located, and higher levels when * needed. * Return OK or FAIL.