From 353052018cbf555c6f0b0400a47194824dcf1ea9 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Mon, 30 Jun 2014 00:22:56 +0200 Subject: Automatically create missing directories when writing tags files --- autoload/xolox/easytags/update.vim | 5 +++++ 1 file changed, 5 insertions(+) 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) -- cgit v1.2.3