v run: windows and repl fixes

pull/1552/head
Delyan Angelov 2019-08-09 23:37:31 +03:00 committed by Alexander Medvednikov
parent efa540e883
commit 5c29a7ef7d
1 changed files with 5 additions and 8 deletions

View File

@ -197,12 +197,8 @@ fn main() {
} }
if 'run' in args { if 'run' in args {
vsource := v.dir // always recompile for now, too error prone to skip recompilation otherwise
vtarget := final_target_out_name( v.out_name ) // for example for -repl usage, especially when piping lines to v
if os.file_exists(vtarget) && ( os.file_last_mod_unix(vsource) <= os.file_last_mod_unix(vtarget) ) {
//println('ALREADY BUILD FROM vsource: $vsource | vtarget: $vtarget')
v.run_compiled_executable_and_exit()
}
v.compile() v.compile()
v.run_compiled_executable_and_exit() v.run_compiled_executable_and_exit()
} }
@ -646,6 +642,7 @@ fn final_target_out_name(out_name string) string {
$if windows { $if windows {
cmd = out_name cmd = out_name
cmd = cmd.replace('/', '\\') cmd = cmd.replace('/', '\\')
cmd += '.exe'
} }
return cmd return cmd
} }
@ -654,7 +651,7 @@ fn (v V) run_compiled_executable_and_exit() {
if v.pref.is_verbose { if v.pref.is_verbose {
println('============ running $v.out_name ============') println('============ running $v.out_name ============')
} }
mut cmd := final_target_out_name(v.out_name) mut cmd := final_target_out_name(v.out_name).replace('.exe','')
if os.args.len > 3 { if os.args.len > 3 {
cmd += ' ' + os.args.right(3).join(' ') cmd += ' ' + os.args.right(3).join(' ')
} }