From 52a14e842238a198a44483a432b083b790e75df4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 26 Mar 2021 11:37:54 +0200 Subject: [PATCH] vpm: fix panic at the end of `v remove ui` --- cmd/tools/vpm.v | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/tools/vpm.v b/cmd/tools/vpm.v index b10fd1e350..be30acb20b 100644 --- a/cmd/tools/vpm.v +++ b/cmd/tools/vpm.v @@ -320,13 +320,20 @@ fn vpm_remove(module_names []string) { final_module_path := valid_final_path_of_existing_module(name) or { continue } println('Removing module "$name"...') verbose_println('removing folder $final_module_path') - os.rmdir_all(final_module_path) or { panic(err) } + os.rmdir_all(final_module_path) or { + verbose_println('error while removing "$final_module_path": $err.msg') + } // delete author directory if it is empty author := name.split('.')[0] author_dir := os.real_path(os.join_path(settings.vmodules_path, author)) + if !os.exists(author_dir) { + continue + } if os.is_dir_empty(author_dir) { verbose_println('removing author folder $author_dir') - os.rmdir(author_dir) or { panic(err) } + os.rmdir(author_dir) or { + verbose_println('error while removing "$author_dir": $err.msg') + } } } }