From 6f992909f041da3875f9a7655e6dc5df01f533f0 Mon Sep 17 00:00:00 2001 From: shayne Date: Wed, 25 Jan 2023 16:58:23 -0500 Subject: [PATCH] hostinfo: [windows] check if running via Scoop (#7068) You can now install Tailscale on Windows via [Scoop](https://scoop.sh). This change adds a check to `packageTypeWindows()`, looking at the exe's path, and checking if it starts with: `C:\User\\scoop\apps\tailscale`. If so, it returns `"scoop"` as the package type. Fixes: #6988 Signed-off-by: Shayne Sweeney --- hostinfo/hostinfo_windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hostinfo/hostinfo_windows.go b/hostinfo/hostinfo_windows.go index 1a4b50f45..d2732ae77 100644 --- a/hostinfo/hostinfo_windows.go +++ b/hostinfo/hostinfo_windows.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "golang.org/x/sys/windows" "golang.org/x/sys/windows/registry" @@ -69,6 +70,10 @@ func packageTypeWindows() string { if err != nil { return "" } + home, _ := os.UserHomeDir() + if strings.HasPrefix(exe, filepath.Join(home, "scoop", "apps", "tailscale")) { + return "scoop" + } dir := filepath.Dir(exe) nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe") _, err = os.Stat(nsisUninstaller)