From b8fa39f96c1be3dc6ae4f04006f07ace95e04383 Mon Sep 17 00:00:00 2001 From: Stefan Liebl Date: Wed, 8 Mar 2017 11:28:14 +0100 Subject: [PATCH] handle eclipse config on staging --- vimfiles.stefan/plugin/toptica.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vimfiles.stefan/plugin/toptica.vim b/vimfiles.stefan/plugin/toptica.vim index b1e3726..21f1a87 100644 --- a/vimfiles.stefan/plugin/toptica.vim +++ b/vimfiles.stefan/plugin/toptica.vim @@ -179,6 +179,11 @@ function s:BuildDirStash(suffix) let subsuffix += 1 endwhile call rename(g:ProjectBuildDir, target_dir) + + " create new build dir and copy eclipse files + call mkdir(g:ProjectBuildDir) + call execute('!cp '.target_dir.'/.cproject '.g:ProjectBuildDir, 'silent!') + call execute('!cp '.target_dir.'/.project '.g:ProjectBuildDir, 'silent!') endfunction function s:BuildDirUnStash(suffix) @@ -190,10 +195,12 @@ function s:BuildDirUnStash(suffix) let source_dir = g:ProjectBuildDir.'.'.suffix if !isdirectory(source_dir) echoerr 'source directory '.source_dir.' not found' - elseif isdirectory(g:ProjectBuildDir) - echoerr 'target directory '.g:ProjectBuildDir.' exists' + elseif isdirectory(g:ProjectBuildDir) && !empty(globpath(g:ProjectBuildDir, '*', 0, 1)) + echoerr 'target directory '.g:ProjectBuildDir.' exists and is not empty' else - call rename(source_dir, g:ProjectBuildDir) + echom 'restore '.source_dir.' to '.g:ProjectBuildDir + call delete(expand(g:ProjectBuildDir), 'rf') + call rename(expand(source_dir), expand(g:ProjectBuildDir)) endif endfunction