From 4f6dde4ac25c3351602e75e0623b30ec3a443d44 Mon Sep 17 00:00:00 2001 From: yuyi Date: Thu, 8 Apr 2021 12:27:56 +0800 Subject: [PATCH] vself: handle missing v_old (#9637) --- cmd/tools/vself.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/tools/vself.v b/cmd/tools/vself.v index 102abdc46d..2a66e4a8f2 100644 --- a/cmd/tools/vself.v +++ b/cmd/tools/vself.v @@ -67,7 +67,9 @@ fn backup_old_version_and_rename_newer() ?bool { bak_file := os.real_path(short_bak_file) list_folder('before:', 'removing $bak_file ...') - os.rm(bak_file) or { errors << 'failed removing $bak_file: $err.msg' } + if os.exists(bak_file) { + os.rm(bak_file) or { errors << 'failed removing $bak_file: $err.msg' } + } list_folder('', 'moving $v_file to $bak_file ...') os.mv(v_file, bak_file) or { errors << err.msg }