fix vtool used with paths w/spaces (win/nix)
parent
43863edc4f
commit
6d7fe1f83c
|
@ -6,12 +6,12 @@ pub fn launch_tool(tname string){
|
||||||
vexe := vexe_path()
|
vexe := vexe_path()
|
||||||
vroot := os.dir(vexe)
|
vroot := os.dir(vexe)
|
||||||
mut oargs := os.args
|
mut oargs := os.args
|
||||||
oargs[0] = vexe // make it more explicit
|
oargs[0] = '"$vexe"' // make it more explicit
|
||||||
tool_exe := os.realpath('$vroot/tools/$tname')
|
tool_exe := os.realpath('$vroot/tools/$tname')
|
||||||
tool_source := os.realpath('$vroot/tools/${tname}.v')
|
tool_source := os.realpath('$vroot/tools/${tname}.v')
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
tool_args := oargs.join(' ')
|
tool_args := oargs.join(' ')
|
||||||
tool_command := '$tool_exe $tool_args'
|
tool_command := '"$tool_exe" $tool_args'
|
||||||
//println('Launching: "$tool_command" ...')
|
//println('Launching: "$tool_command" ...')
|
||||||
|
|
||||||
mut tool_should_be_recompiled := false
|
mut tool_should_be_recompiled := false
|
||||||
|
@ -31,13 +31,12 @@ pub fn launch_tool(tname string){
|
||||||
}
|
}
|
||||||
|
|
||||||
if tool_should_be_recompiled {
|
if tool_should_be_recompiled {
|
||||||
compilation_command := '$vexe $tool_source'
|
compilation_command := '"$vexe" "$tool_source"'
|
||||||
//println('Compiling $tname with: "$compilation_command"')
|
//println('Compiling $tname with: "$compilation_command"')
|
||||||
tool_compilation := os.exec(compilation_command) or { panic(err) }
|
tool_compilation := os.exec(compilation_command) or { panic(err) }
|
||||||
if tool_compilation.exit_code != 0 {
|
if tool_compilation.exit_code != 0 {
|
||||||
panic('V tool "$tool_source" could not be compiled\n' + tool_compilation.output)
|
panic('V tool "$tool_source" could not be compiled\n' + tool_compilation.output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit( os.system(tool_command) )
|
exit( os.system(tool_command) )
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,9 @@ pub fn system(cmd string) int {
|
||||||
}
|
}
|
||||||
mut ret := int(0)
|
mut ret := int(0)
|
||||||
$if windows {
|
$if windows {
|
||||||
ret = C._wsystem(cmd.to_wide())
|
// overcome bug in system & _wsystem (cmd) when first char is quote `"`
|
||||||
|
wcmd := if cmd.len > 1 && cmd[0] == `"` && cmd[1] != `"` { '"$cmd"' } else { cmd }
|
||||||
|
ret = C._wsystem(wcmd.to_wide())
|
||||||
} $else {
|
} $else {
|
||||||
ret = C.system(cmd.str)
|
ret = C.system(cmd.str)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue