diff --git a/cmd/tools/vpm/install.v b/cmd/tools/vpm/install.v index 95729895618c1c..c45d1af7b15b7e 100644 --- a/cmd/tools/vpm/install.v +++ b/cmd/tools/vpm/install.v @@ -184,10 +184,18 @@ fn vpm_install_from_vcs(modules []string, vcs &VCS) { if os.exists(minfo.final_module_path) { eprintln('Warning module "${minfo.final_module_path}" already exists!') eprintln('Removing module "${minfo.final_module_path}" ...') - os.rmdir_all(minfo.final_module_path) or { + mut err_msg := '' + $if windows { + os.execute_opt('rd /s /q ${minfo.final_module_path}') or { + err_msg = err.msg() + } + } $else { + os.rmdir_all(minfo.final_module_path) or { err_msg = err.msg() } + } + if err_msg != '' { errors++ eprintln('Errors while removing "${minfo.final_module_path}" :') - eprintln(err) + eprintln(err_msg) continue } } diff --git a/cmd/tools/vpm/install_test.v b/cmd/tools/vpm/install_test.v index d518d70975a5db..b1434fe42f7ee3 100644 --- a/cmd/tools/vpm/install_test.v +++ b/cmd/tools/vpm/install_test.v @@ -52,11 +52,6 @@ fn test_install_from_git_url() { } fn test_install_already_existent() { - // FIXME: Skip this for now on Windows, as `rmdir_all` results in permission - // errors when vpm tries to remove existing modules. - $if windows { - return - } mut res := os.execute('${v} install https://github.com/vlang/markdown') assert res.exit_code == 0, res.output assert res.output.contains('already exists')