Skip to content

Commit 11bf3dd

Browse files
committed
tools: use ${os.quoted_path(@vexe)} instead of v to improve consistency
1 parent f5b03a9 commit 11bf3dd

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

cmd/tools/git_pre_commit_hook.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
}
5050
configured_stop_committing := os.execute('git config --bool hooks.stopCommitOfNonVfmtedVFiles')
5151
if configured_stop_committing.output.trim_space().bool() {
52-
verify_result := os.execute('v fmt -verify ${vfiles.join(' ')}')
52+
verify_result := os.execute('${os.quoted_path(@VEXE)} fmt -verify ${vfiles.join(' ')}')
5353
if verify_result.exit_code != 0 {
5454
eprintln(verify_result.output)
5555
}

cmd/tools/vquest.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ fn run_issue(cmd cli.Command, issue_query string, issue_label string, help_label
284284
}
285285

286286
fn run_document(cmd cli.Command) ! {
287-
res := os.execute('v missdoc --exclude vlib/v --exclude /linux_bare/ --exclude /wasm_bare/ @vlib')
287+
res := os.execute('${os.quoted_path(@VEXE)} missdoc --exclude vlib/v --exclude /linux_bare/ --exclude /wasm_bare/ @vlib')
288288
if res.exit_code != 0 {
289289
return error('v missdoc failed: ${res.output}')
290290
}

cmd/tools/vreduce.v

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
355355
text_code = create_code(sc)
356356
os.write_file(rpdc_file_path, text_code) or { panic(err) }
357357
if do_fmt {
358-
os.execute('v fmt -w ${rpdc_file_path}')
359-
final_content := os.read_file(rpdc_file_path) or { panic(err) }
360-
show_code_stats(final_content, label: 'Code size after formatting')
358+
vfmt_file(rpdc_file_path)
361359
}
362360
println('The WIP reduced code is now in ${rpdc_file_path}')
363361
}
@@ -433,9 +431,7 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
433431
text_code = create_code(line_tree)
434432
os.write_file(rpdc_file_path, text_code) or { panic(err) }
435433
if do_fmt {
436-
os.execute('v fmt -w ${rpdc_file_path}')
437-
final_content := os.read_file(rpdc_file_path) or { panic(err) }
438-
show_code_stats(final_content, label: 'Code size after formatting')
434+
vfmt_file(rpdc_file_path)
439435
}
440436
println('The WIP reduced code is now in ${rpdc_file_path}')
441437
}
@@ -445,13 +441,17 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
445441
'string_reproduces', @LOCATION)
446442
os.write_file(rpdc_file_path, text_code) or { panic(err) }
447443
if do_fmt {
448-
os.execute('v fmt -w ${rpdc_file_path}')
449-
final_content := os.read_file(rpdc_file_path) or { panic(err) }
450-
show_code_stats(final_content, label: 'Code size after formatting')
444+
vfmt_file(rpdc_file_path)
451445
}
452446
println('The reduced code is now in ${rpdc_file_path}')
453447
}
454448

449+
fn vfmt_file(rpdc_file_path string) {
450+
os.execute('${os.quoted_path(@VEXE)} fmt -w ${rpdc_file_path}')
451+
final_content := os.read_file(rpdc_file_path) or { panic(err) }
452+
show_code_stats(final_content, label: 'Code size after formatting')
453+
}
454+
455455
@[params]
456456
struct ShowParams {
457457
label string = 'Code size'

cmd/v2/test_ssa_backends.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
vroot := os.dir(@VEXE)
1515
v2_source := os.join_path(vroot, 'cmd', 'v2', 'v2.v')
1616
v2_binary := os.join_path(vroot, 'cmd', 'v2', 'v2')
17-
build_res := os.execute('${@VEXE} ${v2_source} -o ${v2_binary}')
17+
build_res := os.execute('${os.quoted_path(@VEXE)} ${v2_source} -o ${v2_binary}')
1818
if build_res.exit_code != 0 {
1919
eprintln('Error: Failed to build v2')
2020
eprintln(build_res.output)
@@ -69,7 +69,7 @@ fn main() {
6969

7070
// Run Reference (v run test.v)
7171
println('[*] Running reference: v -enable-globals run ${input_file}...')
72-
ref_res := os.execute('v -n -w -enable-globals run ${input_file}')
72+
ref_res := os.execute('${os.quoted_path(@VEXE)} -n -w -enable-globals run ${input_file}')
7373
if ref_res.exit_code != 0 {
7474
eprintln('Error: Reference run failed')
7575
eprintln(ref_res.output)

vlib/v/checker/fn.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
14331433
tmp_c_file_with_includes.write_string(includes.join('\n')) or { panic(err) }
14341434
tmp_c_file_with_includes.close()
14351435

1436-
os.execute('v translate fndef ${name[2..]} tmp.c')
1436+
os.execute('${os.quoted_path(@VEXE)} translate fndef ${name[2..]} tmp.c')
14371437
x := os.read_file('__cdefs_autogen.v') or {
14381438
for mut arg in node.args {
14391439
c.expr(mut arg.expr)

0 commit comments

Comments
 (0)