diff --git a/cmd/tools/vup.v b/cmd/tools/vup.v index f114c7b118..d9f06d5f2b 100644 --- a/cmd/tools/vup.v +++ b/cmd/tools/vup.v @@ -3,24 +3,34 @@ module main import ( os filepath + v.pref ) fn main() { println('Updating V...') - vroot := filepath.dir(os.getenv('VEXE')) + vroot := filepath.dir(pref.vexe_path()) os.chdir(vroot) - s := os.exec('git -C "$vroot" pull --rebase origin master') or { panic(err) } + // git pull + s := os.exec('git pull --rebase origin master') or { + panic(err) + } println(s.output) + $if windows { - v_backup_file := '$vroot/v_old.exe' - if os.exists( v_backup_file ) { - os.rm( v_backup_file ) + v_backup_file := 'v_old.exe' + if os.exists(v_backup_file) { + os.rm(v_backup_file) + } + os.mv('v.exe', v_backup_file) + + s2 := os.exec('make.bat') or { + panic(err) } - os.mv('$vroot/v.exe', v_backup_file) - s2 := os.exec('"$vroot/make.bat"') or { panic(err) } println(s2.output) } $else { - s2 := os.exec('make -C "$vroot"') or { panic(err) } + s2 := os.exec('make') or { + panic(err) + } println(s2.output) } }