diff options
author | Peter Odding <peter@peterodding.com> | 2014-06-30 00:22:56 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2014-06-30 00:22:56 +0200 |
commit | 353052018cbf555c6f0b0400a47194824dcf1ea9 (patch) | |
tree | 954e88040b9bde9257d377202a76d044ee434e8b /autoload | |
parent | f02ccb3a775d92704f6b5aef66da401f5820f039 (diff) | |
download | vim-easytags-353052018cbf555c6f0b0400a47194824dcf1ea9.tar.gz |
Automatically create missing directories when writing tags files
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/xolox/easytags/update.vim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/autoload/xolox/easytags/update.vim b/autoload/xolox/easytags/update.vim index ba089e0..3706169 100644 --- a/autoload/xolox/easytags/update.vim +++ b/autoload/xolox/easytags/update.vim @@ -222,6 +222,11 @@ function! xolox#easytags#update#write_tagsfile(tagsfile, headers, entries) " {{{ call extend(lines, a:headers) call extend(lines, a:entries) endif + " Make sure the directory exists. + let directory = fnamemodify(a:tagsfile, ':h') + if !isdirectory(directory) + call mkdir(directory, 'p') + endif " Write the new contents to a temporary file and atomically rename the " temporary file into place while preserving the file's permissions. return xolox#misc#perm#update(a:tagsfile, lines) |