Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/bootstrap/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ var (
deleteScheduledTask = defaultScheduledTaskDelete
)

// RetireCommunityUserPayload removes the per-user community app payload and its
// HKCU uninstall/App Paths/shell registrations. Node installs and runtime dirs stay.
// No-op when this process is itself the LocalAppData community binary.
func RetireCommunityUserPayload(dataRoot string) error {
return cleanupLegacyUserPayload(dataRoot)
}

func cleanupLegacyUserPayload(dataRoot string) error {
programRoot, err := ProgramRoot()
if err != nil {
Expand Down
18 changes: 18 additions & 0 deletions src/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ func main() {
os.Exit(1)
}
return
case "--retire-community-payload":
// Impersonated MSI CA: drop community nvm.exe/utils/.icons and the HKCU
// uninstall entry during install, not on first nvm launch.
settings.Load()
dataRoot, err := bootstrap.DataRoot()
if err != nil || dataRoot == "" {
local := os.Getenv("LOCALAPPDATA")
if local == "" {
fmt.Fprint(os.Stderr, "LOCALAPPDATA is empty; cannot retire community payload\n")
os.Exit(1)
}
dataRoot = filepath.Join(local, "Author Software", "nvm")
}
if err := bootstrap.RetireCommunityUserPayload(dataRoot); err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
return
case "--register-installed-versions":
// Invoked by the installer after migration to ensure all migrated
// versions are registered in Windows Apps the same way normal installs are.
Expand Down
Loading