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

os api: cachedir => cache_dir

This commit is contained in:
yuyi 2020-03-08 22:57:47 +08:00 committed by GitHub
parent 83b6292105
commit a569959fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -36,7 +36,7 @@ fn test_all_v_repl_files() {
bmark: benchmark.new_benchmark() bmark: benchmark.new_benchmark()
} }
// warmup, and ensure that the vrepl is compiled in single threaded mode if it does not exist // warmup, and ensure that the vrepl is compiled in single threaded mode if it does not exist
runner.run_repl_file(os.cachedir(), session.options.vexec, 'vlib/compiler/tests/repl/nothing.repl') or { runner.run_repl_file(os.cache_dir(), session.options.vexec, 'vlib/compiler/tests/repl/nothing.repl') or {
panic(err) panic(err)
} }
session.bmark.set_total_expected_steps(session.options.files.len) session.bmark.set_total_expected_steps(session.options.files.len)
@ -54,7 +54,7 @@ fn test_all_v_repl_files() {
} }
fn worker_repl(p mut sync.PoolProcessor, idx int, thread_id int) voidptr { fn worker_repl(p mut sync.PoolProcessor, idx int, thread_id int) voidptr {
cdir := os.cachedir() cdir := os.cache_dir()
mut session := &Session(p.get_shared_context()) mut session := &Session(p.get_shared_context())
mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx)) mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx))
if isnil(tls_bench) { if isnil(tls_bench) {

View File

@ -1123,8 +1123,8 @@ pub fn mkdir_all(path string) {
} }
} }
// cachedir returns the path to a *writable* user specific folder, suitable for writing non-essential data. // cache_dir returns the path to a *writable* user specific folder, suitable for writing non-essential data.
pub fn cachedir() string { pub fn cache_dir() string {
// See: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html // See: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
// There is a single base directory relative to which user-specific non-essential // There is a single base directory relative to which user-specific non-essential
// (cached) data should be written. This directory is defined by the environment // (cached) data should be written. This directory is defined by the environment
@ -1165,7 +1165,7 @@ pub fn tmpdir() string {
} }
} }
if path == '' { if path == '' {
path = os.cachedir() path = os.cache_dir()
} }
if path == '' { if path == '' {
path = '/tmp' path = '/tmp'