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

os: tmpdir => temp_dir

This commit is contained in:
yuyi
2020-03-10 22:02:09 +08:00
committed by GitHub
parent 7e1870be3e
commit 57b1b12ab6
9 changed files with 13 additions and 13 deletions

View File

@@ -171,8 +171,8 @@ fn (p mut Parser) fnext() {
p.fgen_nl()
p.fmt_inc()
}
if p.token_idx >= p.tokens.len {
return
if p.token_idx >= p.tokens.len {
return
}
// Skip comments and add them to vfmt output
if p.tokens[p.token_idx].tok in [.line_comment, .mline_comment] {
@@ -298,7 +298,7 @@ fn (p &Parser) gen_fmt() {
}
fn write_formatted_source(file_name string, s string) string {
path := os.tmpdir() + '/' + file_name
path := os.temp_dir() + '/' + file_name
mut out := os.create(path) or {
verror('failed to create file $path')
return ''

View File

@@ -6,7 +6,7 @@ module compiler
import os
fn get_vtmp_folder() string {
vtmp := os.join_path(os.tmpdir(), 'v')
vtmp := os.join_path(os.temp_dir(), 'v')
if !os.is_dir(vtmp) {
os.mkdir(vtmp) or {
panic(err)

View File

@@ -1106,7 +1106,7 @@ pub fn cache_dir() string {
}
// tmpdir returns the path to a folder, that is suitable for storing temporary files
pub fn tmpdir() string {
pub fn temp_dir() string {
mut path := os.getenv('TMPDIR')
$if windows {
if path == '' {

View File

@@ -164,7 +164,7 @@ fn test_cp_r() {
}
fn test_tmpdir(){
t := os.tmpdir()
t := os.temp_dir()
assert t.len > 0
assert os.is_dir(t)
@@ -247,7 +247,7 @@ fn test_symlink() {
}
fn test_is_executable_writable_readable() {
file_name := os.tmpdir() + os.path_separator + 'rwxfile.exe'
file_name := os.temp_dir() + os.path_separator + 'rwxfile.exe'
mut f := os.create(file_name) or {
eprintln('failed to create file $file_name')

View File

@@ -21,7 +21,7 @@ fn test_fmt() {
exit(error_missing_vexe)
}
vroot := os.dir(vexe)
tmpfolder := os.tmpdir()
tmpfolder := os.temp_dir()
diff_cmd := find_working_diff_command() or {
''
}

View File

@@ -21,7 +21,7 @@ fn test_fmt() {
exit(error_missing_vexe)
}
vroot := os.dir(vexe)
tmpfolder := os.tmpdir()
tmpfolder := os.temp_dir()
diff_cmd := find_working_diff_command() or {
''
}