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:
@@ -87,8 +87,8 @@ fn glob_match(dir string, pattern string, next_pattern string, mut matches []str
|
||||
mode = GlobMatch.any
|
||||
if next_pattern != pattern && next_pattern != '' {
|
||||
for file in files {
|
||||
if is_dir('$dir/$file') {
|
||||
subdirs << '$dir/$file'
|
||||
if is_dir('${dir}/${file}') {
|
||||
subdirs << '${dir}/${file}'
|
||||
}
|
||||
}
|
||||
return subdirs
|
||||
@@ -115,7 +115,7 @@ fn glob_match(dir string, pattern string, next_pattern string, mut matches []str
|
||||
pathwalk := file.split(os.path_separator)
|
||||
pathwalk[pathwalk.len - 1]
|
||||
} else {
|
||||
fpath = if dir == '.' { file } else { '$dir/$file' }
|
||||
fpath = if dir == '.' { file } else { '${dir}/${file}' }
|
||||
file
|
||||
}
|
||||
if f in ['.', '..'] || f == '' {
|
||||
@@ -146,7 +146,7 @@ fn glob_match(dir string, pattern string, next_pattern string, mut matches []str
|
||||
if is_dir(fpath) {
|
||||
subdirs << fpath
|
||||
if next_pattern == pattern && next_pattern != '' {
|
||||
matches << '$fpath$os.path_separator'
|
||||
matches << '${fpath}${os.path_separator}'
|
||||
}
|
||||
} else {
|
||||
matches << fpath
|
||||
@@ -166,14 +166,14 @@ fn native_glob_pattern(pattern string, mut matches []string) ! {
|
||||
if step == '' {
|
||||
continue
|
||||
}
|
||||
if is_dir('$cwd$os.path_separator$step') {
|
||||
if is_dir('${cwd}${os.path_separator}${step}') {
|
||||
dd := if cwd == '/' {
|
||||
step
|
||||
} else {
|
||||
if cwd == '.' || cwd == '' {
|
||||
step
|
||||
} else {
|
||||
if step == '.' || step == '/' { cwd } else { '$cwd/$step' }
|
||||
if step == '.' || step == '/' { cwd } else { '${cwd}/${step}' }
|
||||
}
|
||||
}
|
||||
if i + 1 != steps.len {
|
||||
@@ -190,7 +190,7 @@ fn native_glob_pattern(pattern string, mut matches []string) ! {
|
||||
if cwd == '.' || cwd == '' {
|
||||
sd
|
||||
} else {
|
||||
if sd == '.' || sd == '/' { cwd } else { '$cwd/$sd' }
|
||||
if sd == '.' || sd == '/' { cwd } else { '${cwd}/${sd}' }
|
||||
}
|
||||
}
|
||||
subs << glob_match(d.replace('//', '/'), step, step2, mut matches)
|
||||
@@ -259,7 +259,7 @@ pub fn ls(path string) ![]string {
|
||||
mut res := []string{cap: 50}
|
||||
dir := unsafe { C.opendir(&char(path.str)) }
|
||||
if isnil(dir) {
|
||||
return error('ls() couldnt open dir "$path"')
|
||||
return error('ls() couldnt open dir "${path}"')
|
||||
}
|
||||
mut ent := &C.dirent(0)
|
||||
// mut ent := &C.dirent{!}
|
||||
@@ -299,7 +299,7 @@ pub fn execute(cmd string) Result {
|
||||
// if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
||||
// return Result{ exit_code: -1, output: ';, &&, || and \\n are not allowed in shell commands' }
|
||||
// }
|
||||
pcmd := if cmd.contains('2>') { cmd.clone() } else { '$cmd 2>&1' }
|
||||
pcmd := if cmd.contains('2>') { cmd.clone() } else { '${cmd} 2>&1' }
|
||||
defer {
|
||||
unsafe { pcmd.free() }
|
||||
}
|
||||
@@ -307,7 +307,7 @@ pub fn execute(cmd string) Result {
|
||||
if isnil(f) {
|
||||
return Result{
|
||||
exit_code: -1
|
||||
output: 'exec("$cmd") failed'
|
||||
output: 'exec("${cmd}") failed'
|
||||
}
|
||||
}
|
||||
fd := fileno(f)
|
||||
@@ -351,7 +351,7 @@ pub fn (mut c Command) start() ! {
|
||||
}
|
||||
c.f = vpopen(pcmd)
|
||||
if isnil(c.f) {
|
||||
return error('exec("$c.path") failed')
|
||||
return error('exec("${c.path}") failed')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,10 +437,10 @@ fn C.mkstemp(stemplate &u8) int
|
||||
[manualfree]
|
||||
pub fn ensure_folder_is_writable(folder string) ! {
|
||||
if !exists(folder) {
|
||||
return error_with_code('`$folder` does not exist', 1)
|
||||
return error_with_code('`${folder}` does not exist', 1)
|
||||
}
|
||||
if !is_dir(folder) {
|
||||
return error_with_code('`$folder` is not a folder', 2)
|
||||
return error_with_code('`${folder}` is not a folder', 2)
|
||||
}
|
||||
tmp_perm_check := join_path_single(folder, 'XXXXXX')
|
||||
defer {
|
||||
@@ -449,7 +449,7 @@ pub fn ensure_folder_is_writable(folder string) ! {
|
||||
unsafe {
|
||||
x := C.mkstemp(&char(tmp_perm_check.str))
|
||||
if -1 == x {
|
||||
return error_with_code('folder `$folder` is not writable', 3)
|
||||
return error_with_code('folder `${folder}` is not writable', 3)
|
||||
}
|
||||
C.close(x)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user