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

tools: let v fmt use VTMP too, stabilise v test-cleancode

This commit is contained in:
Delyan Angelov
2021-01-09 20:41:15 +02:00
parent fb7a5ee3af
commit aa37382e8d
4 changed files with 20 additions and 16 deletions

View File

@@ -9,21 +9,8 @@ import rand
import v.pref
import v.util
fn get_vtmp_folder() string {
mut vtmp := os.getenv('VTMP')
if vtmp.len > 0 {
return vtmp
}
vtmp = os.join_path(os.temp_dir(), 'v')
if !os.exists(vtmp) || !os.is_dir(vtmp) {
os.mkdir_all(vtmp)
}
os.setenv('VTMP', vtmp, true)
return vtmp
}
fn (mut b Builder) get_vtmp_filename(base_file_name string, postfix string) string {
vtmp := get_vtmp_folder()
vtmp := util.get_vtmp_folder()
mut uniq := ''
if !b.pref.reuse_tmpc {
uniq = '.$rand.u64()'

View File

@@ -462,6 +462,19 @@ pub fn recompile_file(vexe string, file string) {
}
}
pub fn get_vtmp_folder() string {
mut vtmp := os.getenv('VTMP')
if vtmp.len > 0 {
return vtmp
}
vtmp = os.join_path(os.temp_dir(), 'v')
if !os.exists(vtmp) || !os.is_dir(vtmp) {
os.mkdir_all(vtmp)
}
os.setenv('VTMP', vtmp, true)
return vtmp
}
pub fn should_bundle_module(mod string) bool {
return mod in bundle_modules || (mod.contains('.') && mod.all_before('.') in bundle_modules)
}