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

22 lines
545 B
V
Raw Normal View History

2020-02-03 07:00:36 +03:00
// Copyright (c) 2019-2020 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
2020-02-09 12:08:04 +03:00
fn get_vtmp_folder() string {
2020-03-10 17:02:09 +03:00
vtmp := os.join_path(os.temp_dir(), 'v')
2019-12-20 00:29:37 +03:00
if !os.is_dir(vtmp) {
2020-03-09 04:23:34 +03:00
os.mkdir(vtmp) or {
2019-12-20 00:29:37 +03:00
panic(err)
}
}
return vtmp
}
2020-02-09 12:08:04 +03:00
fn get_vtmp_filename(base_file_name string, postfix string) string {
vtmp := get_vtmp_folder()
2020-03-20 18:41:18 +03:00
return os.real_path(os.join_path(vtmp, os.file_name(os.real_path(base_file_name)) + postfix))
}