diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-05 13:50:55 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-05 13:50:55 +0000 |
commit | c216a7a21a25a701b84b79abc1ba6ab0baa3a311 (patch) | |
tree | e8bda92c7339e1960d00dc035f0de82f3c2b975a /src/evalfunc.c | |
parent | 65214053f6a4bdb1099404a4b5dccb85ca3e5c7c (diff) |
patch 9.0.1007: there is no way to get a list of swap file namesv9.0.1007
Problem: There is no way to get a list of swap file names.
Solution: Add the swapfilelist() function. Use it in the test script to
clean up. Remove deleting individual swap files.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index fa63ab2e21..0b2ba00b6e 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -168,6 +168,7 @@ static void f_split(typval_T *argvars, typval_T *rettv); static void f_srand(typval_T *argvars, typval_T *rettv); static void f_submatch(typval_T *argvars, typval_T *rettv); static void f_substitute(typval_T *argvars, typval_T *rettv); +static void f_swapfilelist(typval_T *argvars, typval_T *rettv); static void f_swapinfo(typval_T *argvars, typval_T *rettv); static void f_swapname(typval_T *argvars, typval_T *rettv); static void f_synID(typval_T *argvars, typval_T *rettv); @@ -2579,6 +2580,8 @@ static funcentry_T global_functions[] = ret_string, f_submatch}, {"substitute", 4, 4, FEARG_1, arg4_string_string_any_string, ret_string, f_substitute}, + {"swapfilelist", 0, 0, 0, NULL, + ret_list_string, f_swapfilelist}, {"swapinfo", 1, 1, FEARG_1, arg1_string, ret_dict_any, f_swapinfo}, {"swapname", 1, 1, FEARG_1, arg1_buffer, @@ -10171,6 +10174,17 @@ f_substitute(typval_T *argvars, typval_T *rettv) } /* + * "swapfilelist()" function + */ + static void +f_swapfilelist(typval_T *argvars UNUSED, typval_T *rettv) +{ + if (rettv_list_alloc(rettv) == FAIL) + return; + recover_names(NULL, FALSE, rettv->vval.v_list, 0, NULL); +} + +/* * "swapinfo(swap_filename)" function */ static void |