diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-07 21:30:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-07 21:30:44 +0100 |
commit | 6f14da15ac900589f2f413d77898b9bff3b31ece (patch) | |
tree | 883f0ce338a539bea95f17fec21a76d5990e6076 /runtime | |
parent | d7633114af2365e32080b61af473db347a3489c2 (diff) |
patch 9.0.0411: only created files can be cleaned up with one callv9.0.0411
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.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 1de0e40ad1..12d62a6760 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6239,8 +6239,26 @@ min({expr}) Return the minimum value of all items in {expr}. Example: > mkdir({name} [, {path} [, {prot}]]) Create directory {name}. - If {path} is "p" then intermediate directories are created as - necessary. Otherwise it must be "". + If {path} contains "p" then intermediate directories are + created as necessary. Otherwise it must be "". + + If {path} contains "D" then {name} is deleted at the end of + the current function, as with: > + defer delete({name}, 'd') +< + If {path} contains "R" then {name} is deleted recursively at + the end of the current function, as with: > + defer delete({name}, 'rf') +< Note that when {name} has more than one part and "p" is used + some directories may already exist. Only the first one that + is created and what it contains is scheduled to be deleted. + E.g. when using: > + call mkdir('subdir/tmp/autoload', 'pR') +< and "subdir" already exists then "subdir/tmp" will be + scheduled for deletion, like with: > + defer delete('subdir/tmp', 'rf') +< Note that if scheduling the defer fails the directory is not + deleted. This should only happen when out of memory. If {prot} is given it is used to set the protection bits of the new directory. The default is 0o755 (rwxr-xr-x: r/w for |