From 7a79c94a9e4045481ee5647a94b01e40ab42d7de Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 27 Jan 2020 17:56:32 +0200 Subject: [PATCH] tools/oldv: fix default behaviour (regression caused by 760448a) --- tools/modules/scripting/scripting.v | 11 +++++++++++ tools/oldv.v | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/modules/scripting/scripting.v b/tools/modules/scripting/scripting.v index 18f744123c..8d1574d0ae 100644 --- a/tools/modules/scripting/scripting.v +++ b/tools/modules/scripting/scripting.v @@ -39,6 +39,17 @@ pub fn chdir(path string) { os.chdir(path) } +pub fn rmrf(path string) { + verbose_trace(@FN, 'rm -rf $path') + if os.exists(path) { + if os.is_dir(path) { + os.rmdir_recursive(path) + }else{ + os.rm(path) + } + } +} + pub fn run(cmd string) string { verbose_trace(@FN, cmd) x := os.exec(cmd) or { diff --git a/tools/oldv.v b/tools/oldv.v index e3194bfb0a..b5645e82cb 100644 --- a/tools/oldv.v +++ b/tools/oldv.v @@ -1,6 +1,5 @@ import ( os - os.cmdline flag filepath scripting @@ -100,8 +99,8 @@ fn main() { context.cc = ecc } if context.cleanup { - os.rmdir_recursive(context.path_v) - os.rmdir_recursive(context.path_vc) + scripting.rmrf(context.path_v) + scripting.rmrf(context.path_vc) } context.compile_oldv_if_needed()