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

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@@ -396,7 +396,7 @@ pub fn user_names() ![]string {
$if windows {
result := execute('wmic useraccount get name')
if result.exit_code != 0 {
return error('Failed to get user names. Exited with code $result.exit_code: $result.output')
return error('Failed to get user names. Exited with code ${result.exit_code}: ${result.output}')
}
mut users := result.output.split_into_lines()
// windows command prints an empty line at the end of output
@@ -662,7 +662,7 @@ pub fn mkdir_all(opath string, params MkdirParams) ! {
if exists(p) && is_dir(p) {
continue
}
mkdir(p, params) or { return error('folder: $p, error: $err') }
mkdir(p, params) or { return error('folder: ${p}, error: ${err}') }
}
}
@@ -727,7 +727,7 @@ pub fn vtmp_dir() string {
return vtmp
}
uid := getuid()
vtmp = join_path_single(temp_dir(), 'v_$uid')
vtmp = join_path_single(temp_dir(), 'v_${uid}')
if !exists(vtmp) || !is_dir(vtmp) {
// create a new directory, that is private to the user:
mkdir_all(vtmp, mode: 0o700) or { panic(err) }
@@ -817,8 +817,8 @@ pub mut:
pub fn execute_or_panic(cmd string) Result {
res := execute(cmd)
if res.exit_code != 0 {
eprintln('failed cmd: $cmd')
eprintln('failed code: $res.exit_code')
eprintln('failed cmd: ${cmd}')
eprintln('failed code: ${res.exit_code}')
panic(res.output)
}
return res
@@ -827,8 +827,8 @@ pub fn execute_or_panic(cmd string) Result {
pub fn execute_or_exit(cmd string) Result {
res := execute(cmd)
if res.exit_code != 0 {
eprintln('failed cmd: $cmd')
eprintln('failed code: $res.exit_code')
eprintln('failed cmd: ${cmd}')
eprintln('failed code: ${res.exit_code}')
eprintln(res.output)
exit(1)
}
@@ -838,9 +838,13 @@ pub fn execute_or_exit(cmd string) Result {
// quoted path - return a quoted version of the path, depending on the platform.
pub fn quoted_path(path string) string {
$if windows {
return if path.ends_with(path_separator) { '"${path + path_separator}"' } else { '"$path"' }
return if path.ends_with(path_separator) {
'"${path + path_separator}"'
} else {
'"${path}"'
}
} $else {
return "'$path'"
return "'${path}'"
}
}