1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: unify all temporary files/folders under $VTMP/v, that can be cleaned by v wipe-cache (#15774)

This commit is contained in:
Delyan Angelov
2022-09-16 04:56:19 +03:00
committed by GitHub
parent 7e69619add
commit f922ed0941
28 changed files with 210 additions and 144 deletions

View File

@@ -2,12 +2,18 @@ module main
import os
import v.vcache
import v.util
fn main() {
mut cm := vcache.new_cache_manager([])
cpath := cm.basepath
wipe_path(vcache.new_cache_manager([]).basepath, 'V cache')
wipe_path(util.get_vtmp_folder(), 'V tmp.c')
wipe_path(os.join_path(os.temp_dir(), 'v'), 'V tests')
}
fn wipe_path(cpath string, label string) {
if os.exists(cpath) && os.is_dir(cpath) {
os.rmdir_all(cpath) or {}
}
println('V cache folder $cpath was wiped.')
os.mkdir_all(cpath) or {}
println('$label folder $cpath was wiped.')
}