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

use os.quoted_path more

This commit is contained in:
Delyan Angelov
2022-01-22 21:56:01 +02:00
parent fa6f7d4c83
commit 62c3ad4953
12 changed files with 42 additions and 29 deletions

View File

@@ -166,7 +166,7 @@ fn (mut b Builder) v_build_module(vexe string, imp_path string) {
vroot := os.dir(vexe)
os.chdir(vroot) or {}
boptions := b.pref.build_options.join(' ')
rebuild_cmd := '$vexe $boptions build-module $imp_path'
rebuild_cmd := '${os.quoted_path(vexe)} $boptions build-module ${os.quoted_path(imp_path)}'
vcache.dlog('| Builder.' + @FN, 'vexe: $vexe | imp_path: $imp_path | rebuild_cmd: $rebuild_cmd')
$if trace_v_build_module ? {
eprintln('> Builder.v_build_module: $rebuild_cmd')

View File

@@ -61,7 +61,7 @@ fn opendiff_exists() bool {
pub fn color_compare_files(diff_cmd string, file1 string, file2 string) string {
if diff_cmd != '' {
full_cmd := '$diff_cmd --minimal --text --unified=2 --show-function-line="fn " "$file1" "$file2" '
full_cmd := '$diff_cmd --minimal --text --unified=2 --show-function-line="fn " ${os.quoted_path(file1)} ${os.quoted_path(file2)} '
x := os.execute(full_cmd)
if x.exit_code < 0 {
return 'comparison command: `$full_cmd` not found'

View File

@@ -155,7 +155,7 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
for emodule in emodules {
check_module_is_installed(emodule, is_verbose) or { panic(err) }
}
mut compilation_command := "'$vexe' -skip-unused "
mut compilation_command := '${os.quoted_path(vexe)} -skip-unused '
if tool_name in ['vself', 'vup', 'vdoctor', 'vsymlink'] {
// These tools will be called by users in cases where there
// is high chance of there being a problem somewhere. Thus
@@ -164,7 +164,7 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
// .v line numbers, to ease diagnostic in #bugs and issues.
compilation_command += ' -g '
}
compilation_command += "'$tool_source'"
compilation_command += os.quoted_path(tool_source)
if is_verbose {
println('Compiling $tool_name with: "$compilation_command"')
}
@@ -175,10 +175,10 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
}
}
$if windows {
exit(os.system('"$tool_exe" $tool_args'))
exit(os.system('${os.quoted_path(tool_exe)} $tool_args'))
} $else $if js {
// no way to implement os.execvp in JS backend
exit(os.system('\'$tool_exe\' $tool_args'))
exit(os.system('${os.quote_path(tool_exe)} $tool_args'))
} $else {
os.execvp(tool_exe, args) or { panic(err) }
}
@@ -348,7 +348,7 @@ pub fn check_module_is_installed(modulename string, is_verbose bool) ?bool {
}
if os.exists(mod_v_file) {
vexe := pref.vexe_path()
update_cmd := "'$vexe' update '$modulename'"
update_cmd := "${os.quoted_path(vexe)} update '$modulename'"
if is_verbose {
eprintln('check_module_is_installed: updating with $update_cmd ...')
}
@@ -448,7 +448,7 @@ pub fn prepare_tool_when_needed(source_name string) {
}
pub fn recompile_file(vexe string, file string) {
cmd := "'$vexe' '$file'"
cmd := '${os.quoted_path(vexe)} ${os.quoted_path(file)}'
$if trace_recompilation ? {
println('recompilation command: $cmd')
}