From c586708677d07cb8e64d24a249687c70a4273353 Mon Sep 17 00:00:00 2001 From: mitchell Date: Mon, 11 Dec 2023 16:47:58 -0500 Subject: [PATCH] Use installation package for directory determination. --- internal/runners/clean/run_win.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/runners/clean/run_win.go b/internal/runners/clean/run_win.go index 0df2a1fa8b..adb4992c51 100644 --- a/internal/runners/clean/run_win.go +++ b/internal/runners/clean/run_win.go @@ -117,11 +117,14 @@ func removeInstall(logFile string, params *UninstallParams, cfg *config.Instance return locale.WrapError(err, "err_state_exec") } - // Schedule removal of the entire branch name directory. + // Schedule removal of the entire install directory. // This is because Windows often thinks the installation.InstallDirMarker and // constants.StateInstallerCmd files are still in use. - branchDir := filepath.Dir(filepath.Dir(stateExec)) - paths := []string{stateExec, branchDir} + installDir, err := installation.InstallPathFromExecPath() + if err != nil { + return errs.Wrap(err, "Could not get installation path") + } + paths := []string{stateExec, installDir} if params.All { paths = append(paths, cfg.ConfigPath()) // also remove the config directory }