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

23 lines
563 B
V
Raw Normal View History

// Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module compiler
import os
import filepath
pub fn get_vtmp_folder() string {
vtmp := filepath.join(os.tmpdir(),'v')
2019-12-20 00:29:37 +03:00
if !os.is_dir(vtmp) {
os.mkdir(vtmp)or{
panic(err)
}
}
return vtmp
}
pub fn get_vtmp_filename(base_file_name string, postfix string) string {
vtmp := get_vtmp_folder()
2019-12-23 13:09:22 +03:00
return os.realpath(filepath.join(vtmp,filepath.filename(os.realpath(base_file_name)) + postfix))
}