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

@ -21,10 +21,10 @@ pub fn temp_file(tfo TempFileOptions) !(os.File, string) {
}
os.ensure_folder_is_writable(d) or {
return error(@FN +
' could not create temporary file in "$d". Please ensure write permissions.')
' could not create temporary file in "${d}". Please ensure write permissions.')
}
d = d.trim_right(os.path_separator)
prefix, suffix := prefix_and_suffix(tfo.pattern) or { return error(@FN + ' $err.msg()') }
prefix, suffix := prefix_and_suffix(tfo.pattern) or { return error(@FN + ' ${err.msg()}') }
for retry := 0; retry < util.retries; retry++ {
path := os.join_path(d, prefix + random_number() + suffix)
mut mode := 'rw+'
@ -37,7 +37,7 @@ pub fn temp_file(tfo TempFileOptions) !(os.File, string) {
}
}
return error(@FN +
' could not create temporary file in "$d". Retry limit ($util.retries) exhausted. Please ensure write permissions.')
' could not create temporary file in "${d}". Retry limit (${util.retries}) exhausted. Please ensure write permissions.')
}
[params]
@ -47,7 +47,7 @@ pub struct TempDirOptions {
}
fn error_for_temporary_folder(fn_name string, d string) !string {
return error('$fn_name could not create temporary directory "$d". Please ensure you have write permissions for it.')
return error('${fn_name} could not create temporary directory "${d}". Please ensure you have write permissions for it.')
}
// temp_dir returns an uniquely named, writable, directory path
@ -58,7 +58,7 @@ pub fn temp_dir(tdo TempFileOptions) !string {
}
os.ensure_folder_is_writable(d) or { return error_for_temporary_folder(@FN, d) }
d = d.trim_right(os.path_separator)
prefix, suffix := prefix_and_suffix(tdo.pattern) or { return error(@FN + ' $err.msg()') }
prefix, suffix := prefix_and_suffix(tdo.pattern) or { return error(@FN + ' ${err.msg()}') }
for retry := 0; retry < util.retries; retry++ {
path := os.join_path(d, prefix + random_number() + suffix)
os.mkdir_all(path) or { continue }
@ -67,7 +67,7 @@ pub fn temp_dir(tdo TempFileOptions) !string {
return path
}
}
return error('${@FN} could not create temporary directory "$d". Retry limit ($util.retries) exhausted.')
return error('${@FN} could not create temporary directory "${d}". Retry limit (${util.retries}) exhausted.')
}
// * Utility functions
@ -79,7 +79,7 @@ fn random_number() string {
fn prefix_and_suffix(pattern string) ?(string, string) {
mut pat := pattern
if pat.contains(os.path_separator) {
return error('pattern cannot contain path separators ($os.path_separator).')
return error('pattern cannot contain path separators (${os.path_separator}).')
}
pos := pat.last_index('*') or { -1 }
mut prefix := ''