Files
magpie/internal/agent/claudedesktop_installed_test.go
T
yetone 612b759d21 agent: Claude Desktop installed on Windows and not yet opened is listed (#1482, edussss)
Claude Desktop was listed by its data folders (%APPDATA%\Claude,
%LOCALAPPDATA%\Claude, the MSIX LocalCache), which it makes when first
opened. desktopdir.Installed now also counts Squirrel's
%LOCALAPPDATA%\AnthropicClaude\claude.exe and the MSIX's package folder;
an AnthropicClaude folder left without claude.exe doesn't count.

Run: TestClaudeDesktopInstalledNotOpened (red without Installed) on
macOS and on the Windows box, the existing TestClaudeDesktop* tests, the
full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows.
2026-10-11 08:18:27 +08:00

49 lines
1.5 KiB
Go

package agent
import (
"os"
"path/filepath"
"testing"
"github.com/yetone/magpie/internal/desktopdir"
)
// Claude Desktop installed on Windows and not yet opened has none of its
// folders, so it wasn't listed (#1482): Squirrel's setup has put
// %LOCALAPPDATA%\AnthropicClaude\claude.exe there, the MSIX its package
// folder. Either is Desktop installed; a leftover AnthropicClaude folder
// without its claude.exe is not.
func TestClaudeDesktopInstalledNotOpened(t *testing.T) {
old := desktopdir.OS
desktopdir.OS = "windows"
t.Cleanup(func() { desktopdir.OS = old })
for _, tc := range []struct {
name string
make []string
dir bool
want bool
}{
{"nothing", nil, false, false},
{"Squirrel's setup", []string{"AnthropicClaude", "claude.exe"}, false, true},
{"an uninstall's leftover", []string{"AnthropicClaude", "packages"}, true, false},
{"the MSIX", []string{"Packages", "Claude_pzs8sxrjxfjjc"}, true, true},
{"the Store's MSIX", []string{"Packages", "AnthropicPBC.Claude_fnn82j28hfe8t"}, true, true},
} {
t.Run(tc.name, func(t *testing.T) {
home, _ := desktopSandbox(t)
local := filepath.Join(home, "AppData", "Local")
if tc.make != nil {
p := filepath.Join(append([]string{local}, tc.make...)...)
if tc.dir {
os.MkdirAll(p, 0o755)
} else {
desktopWrite(t, p, "")
}
}
if got := claudeDesktop(home).Detected(); got != tc.want {
t.Fatalf("Claude Desktop listed: %v, want %v", got, tc.want)
}
})
}
}