diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-16 11:46:17 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-16 15:04:41 +0800 |
commit | f39b33ee491a4a8d4b08425e582dd0dd53617edf (patch) | |
tree | 0214457dc93e79a07307268ea5015ecc49579c9c /src/nvim/os/fs.c | |
parent | 7b05ddbb72717f995fedc81583d73f82c78c881d (diff) | |
download | rneovim-f39b33ee491a4a8d4b08425e582dd0dd53617edf.tar.gz rneovim-f39b33ee491a4a8d4b08425e582dd0dd53617edf.tar.bz2 rneovim-f39b33ee491a4a8d4b08425e582dd0dd53617edf.zip |
vim-patch:9.0.0411: only created files can be cleaned up with one call
Problem: Only created files can be cleaned up with one call.
Solution: Add flags to mkdir() to delete with a deferred function.
Expand the writefile() name to a full path to handle changing
directory.
https://github.com/vim/vim/commit/6f14da15ac900589f2f413d77898b9bff3b31ece
vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry
Problem: Dec mouse test fails without gnome terminfo entry.
Solution: Check if there is a gnome entry. Also fix 'acd' test on
MS-Windows. (Dominique Pellé, closes vim/vim#9282)
https://github.com/vim/vim/commit/f589fd3e1047cdf90566b68aaf9a13389e54d26a
Cherry-pick test_autochdir.vim changes from patch 9.0.0313.
Cherry-pick test_autocmd.vim changes from patch 9.0.0323.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r-- | src/nvim/os/fs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index cb51e81005..872d9c9314 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -937,10 +937,13 @@ int os_mkdir(const char *path, int32_t mode) /// the name of the directory which os_mkdir_recurse /// failed to create. I.e. it will contain dir or any /// of the higher level directories. +/// @param[out] created Set to the full name of the first created directory. +/// It will be NULL until that happens. /// /// @return `0` for success, libuv error code for failure. -int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_dir) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT +int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_dir, + char **const created) + FUNC_ATTR_NONNULL_ARG(1, 3) FUNC_ATTR_WARN_UNUSED_RESULT { // Get end of directory name in "dir". // We're done when it's "/" or "c:/". @@ -975,6 +978,8 @@ int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_di if ((ret = os_mkdir(curdir, mode)) != 0) { *failed_dir = curdir; return ret; + } else if (created != NULL && *created == NULL) { + *created = FullName_save(curdir, false); } } xfree(curdir); @@ -1002,7 +1007,7 @@ int os_file_mkdir(char *fname, int32_t mode) *tail = NUL; int r; char *failed_dir; - if (((r = os_mkdir_recurse(fname, mode, &failed_dir)) < 0)) { + if (((r = os_mkdir_recurse(fname, mode, &failed_dir, NULL)) < 0)) { semsg(_(e_mkdir), failed_dir, os_strerror(r)); xfree(failed_dir); } |