os: tmpdir => temp_dir
parent
7e1870be3e
commit
57b1b12ab6
|
@ -80,7 +80,7 @@ pub fn (ts mut TestSession) test() {
|
||||||
|
|
||||||
fn worker_trunner(p mut sync.PoolProcessor, idx int, thread_id int) voidptr {
|
fn worker_trunner(p mut sync.PoolProcessor, idx int, thread_id int) voidptr {
|
||||||
mut ts := &TestSession(p.get_shared_context())
|
mut ts := &TestSession(p.get_shared_context())
|
||||||
tmpd := os.tmpdir()
|
tmpd := os.temp_dir()
|
||||||
show_stats := '-stats' in ts.vargs.split(' ')
|
show_stats := '-stats' in ts.vargs.split(' ')
|
||||||
// tls_bench is used to format the step messages/timings
|
// tls_bench is used to format the step messages/timings
|
||||||
mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx))
|
mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx))
|
||||||
|
|
|
@ -136,7 +136,7 @@ pub fn (vgit_context mut VGitContext) compile_oldv_if_needed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_common_tool_options<T>(context mut T, fp mut flag.FlagParser) []string {
|
pub fn add_common_tool_options<T>(context mut T, fp mut flag.FlagParser) []string {
|
||||||
tdir := os.tmpdir()
|
tdir := os.temp_dir()
|
||||||
context.workdir = os.realpath(fp.string_('workdir', `w`, tdir, 'A writable base folder. Default: $tdir'))
|
context.workdir = os.realpath(fp.string_('workdir', `w`, tdir, 'A writable base folder. Default: $tdir'))
|
||||||
context.v_repo_url = fp.string('vrepo', vgit.remote_v_repo_url, 'The url of the V repository. You can clone it locally too. See also --vcrepo below.')
|
context.v_repo_url = fp.string('vrepo', vgit.remote_v_repo_url, 'The url of the V repository. You can clone it locally too. See also --vcrepo below.')
|
||||||
context.vc_repo_url = fp.string('vcrepo', vgit.remote_vc_repo_url, 'The url of the vc repository. You can clone it
|
context.vc_repo_url = fp.string('vcrepo', vgit.remote_vc_repo_url, 'The url of the vc repository. You can clone it
|
||||||
|
|
|
@ -155,7 +155,7 @@ fn (foptions &FormatOptions) format_file(file string) {
|
||||||
file_ast := parser.parse_file(file, table, .parse_comments)
|
file_ast := parser.parse_file(file, table, .parse_comments)
|
||||||
formatted_content := fmt.fmt(file_ast, table)
|
formatted_content := fmt.fmt(file_ast, table)
|
||||||
file_name := os.filename(file)
|
file_name := os.filename(file)
|
||||||
vfmt_output_path := os.join_path(os.tmpdir(), 'vfmt_' + file_name)
|
vfmt_output_path := os.join_path(os.temp_dir(), 'vfmt_' + file_name)
|
||||||
os.write_file(vfmt_output_path, formatted_content )
|
os.write_file(vfmt_output_path, formatted_content )
|
||||||
if foptions.is_verbose {
|
if foptions.is_verbose {
|
||||||
eprintln('vfmt2 fmt.fmt worked and ${formatted_content.len} bytes were written to ${vfmt_output_path} .')
|
eprintln('vfmt2 fmt.fmt worked and ${formatted_content.len} bytes were written to ${vfmt_output_path} .')
|
||||||
|
@ -163,7 +163,7 @@ fn (foptions &FormatOptions) format_file(file string) {
|
||||||
eprintln('${FORMATTED_FILE_TOKEN}${vfmt_output_path}')
|
eprintln('${FORMATTED_FILE_TOKEN}${vfmt_output_path}')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tmpfolder := os.tmpdir()
|
tmpfolder := os.temp_dir()
|
||||||
mut compiler_params := &pref.Preferences{}
|
mut compiler_params := &pref.Preferences{}
|
||||||
target_os := file_to_target_os(file)
|
target_os := file_to_target_os(file)
|
||||||
if target_os != '' {
|
if target_os != '' {
|
||||||
|
|
|
@ -171,8 +171,8 @@ fn (p mut Parser) fnext() {
|
||||||
p.fgen_nl()
|
p.fgen_nl()
|
||||||
p.fmt_inc()
|
p.fmt_inc()
|
||||||
}
|
}
|
||||||
if p.token_idx >= p.tokens.len {
|
if p.token_idx >= p.tokens.len {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Skip comments and add them to vfmt output
|
// Skip comments and add them to vfmt output
|
||||||
if p.tokens[p.token_idx].tok in [.line_comment, .mline_comment] {
|
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 {
|
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 {
|
mut out := os.create(path) or {
|
||||||
verror('failed to create file $path')
|
verror('failed to create file $path')
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -6,7 +6,7 @@ module compiler
|
||||||
import os
|
import os
|
||||||
|
|
||||||
fn get_vtmp_folder() string {
|
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) {
|
if !os.is_dir(vtmp) {
|
||||||
os.mkdir(vtmp) or {
|
os.mkdir(vtmp) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ pub fn cache_dir() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// tmpdir returns the path to a folder, that is suitable for storing temporary files
|
// 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')
|
mut path := os.getenv('TMPDIR')
|
||||||
$if windows {
|
$if windows {
|
||||||
if path == '' {
|
if path == '' {
|
||||||
|
|
|
@ -164,7 +164,7 @@ fn test_cp_r() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_tmpdir(){
|
fn test_tmpdir(){
|
||||||
t := os.tmpdir()
|
t := os.temp_dir()
|
||||||
assert t.len > 0
|
assert t.len > 0
|
||||||
assert os.is_dir(t)
|
assert os.is_dir(t)
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ fn test_symlink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_is_executable_writable_readable() {
|
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 {
|
mut f := os.create(file_name) or {
|
||||||
eprintln('failed to create file $file_name')
|
eprintln('failed to create file $file_name')
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn test_fmt() {
|
||||||
exit(error_missing_vexe)
|
exit(error_missing_vexe)
|
||||||
}
|
}
|
||||||
vroot := os.dir(vexe)
|
vroot := os.dir(vexe)
|
||||||
tmpfolder := os.tmpdir()
|
tmpfolder := os.temp_dir()
|
||||||
diff_cmd := find_working_diff_command() or {
|
diff_cmd := find_working_diff_command() or {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn test_fmt() {
|
||||||
exit(error_missing_vexe)
|
exit(error_missing_vexe)
|
||||||
}
|
}
|
||||||
vroot := os.dir(vexe)
|
vroot := os.dir(vexe)
|
||||||
tmpfolder := os.tmpdir()
|
tmpfolder := os.temp_dir()
|
||||||
diff_cmd := find_working_diff_command() or {
|
diff_cmd := find_working_diff_command() or {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue