From 87247497282f660733a542bc5a4b14ea3f8b2ba0 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 30 Dec 2020 21:36:54 +0200 Subject: [PATCH] tools: implement `v wipe-cache` to ease cleaning up the cache on windows --- cmd/tools/vwipe-cache.v | 13 +++++++++++++ cmd/v/v.v | 1 + 2 files changed, 14 insertions(+) create mode 100644 cmd/tools/vwipe-cache.v diff --git a/cmd/tools/vwipe-cache.v b/cmd/tools/vwipe-cache.v new file mode 100644 index 0000000000..a72be1c845 --- /dev/null +++ b/cmd/tools/vwipe-cache.v @@ -0,0 +1,13 @@ +module main + +import os +import v.vcache + +fn main() { + mut cm := vcache.new_cache_manager([]) + cpath := cm.basepath + if os.exists(cpath) && os.is_dir(cpath) { + os.rmdir_all(cpath) + } + println('V cache folder $cpath was wiped.') +} diff --git a/cmd/v/v.v b/cmd/v/v.v index 634d0a5307..56f22409aa 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -30,6 +30,7 @@ const ( 'build-examples', 'build-vbinaries', 'setup-freetype', + 'wipe-cache', 'doc', 'doctor', ]