From 1d7b9a3b0b18f5a973d290b570020d83fa20656a Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 15 Sep 2019 04:33:08 +0300 Subject: [PATCH] v up: on windows delete existing v_old.exe before renaming the new v.exe to it --- compiler/main.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/main.v b/compiler/main.v index 2318b31977..ee1b45da74 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -893,7 +893,11 @@ fn update_v() { } println(s.output) $if windows { - os.mv('$vroot/v.exe', '$vroot/v_old.exe') + v_backup_file := '$vroot/v_old.exe' + if os.file_exists( v_backup_file ) { + os.rm( v_backup_file ) + } + os.mv('$vroot/v.exe', v_backup_file) s2 := os.exec('$vroot/make.bat') or { cerror(err) return