From 373a2e055669cfe276569a59665544adee78cb33 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 4 Nov 2023 04:12:56 +0100 Subject: [PATCH 1/2] tools.vpm: fix windows install of already existing module --- cmd/tools/vpm/install.v | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 } } From bccf63e004da707ab5f484c577e82fcee26b8015 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 4 Nov 2023 04:18:14 +0100 Subject: [PATCH 2/2] enable test for windows --- cmd/tools/vpm/install_test.v | 5 ----- 1 file changed, 5 deletions(-) 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')