1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vself: handle missing v_old (#9637)

This commit is contained in:
yuyi 2021-04-08 12:27:56 +08:00 committed by GitHub
parent e03db643dc
commit 4f6dde4ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 }