InstalledAppsFor returns the code agent IDs where the item is installed on disk. An item is considered installed to an app when a directory named after the item exists under that app's install path for its kind.
(item Item)
| 549 | // An item is considered installed to an app when a directory named after the item |
| 550 | // exists under that app's install path for its kind. |
| 551 | func InstalledAppsFor(item Item) []string { |
| 552 | kind := entities.Kind(item.Kind) |
| 553 | apps := entities.AppPathsFor(kind) |
| 554 | if apps == nil { |
| 555 | return nil |
| 556 | } |
| 557 | name := installDirName(item) |
| 558 | if name == "" { |
| 559 | return nil |
| 560 | } |
| 561 | var installed []string |
| 562 | for app, dest := range apps { |
| 563 | // Expand ~ before joining so the home prefix survives on Windows |
| 564 | // (filepath.Join would otherwise flip ~/ to ~\ and break Expand). |
| 565 | resolved := filepath.Join(pathutil.Expand(dest), name) |
| 566 | if info, err := os.Stat(resolved); err == nil && info.IsDir() { |
| 567 | installed = append(installed, app) |
| 568 | } |
| 569 | } |
| 570 | return installed |
| 571 | } |
| 572 | |
| 573 | // installDirName is the on-disk directory name used when the item is installed. |
| 574 | // It prefers the item Name (matching entities.InstallToApp) and falls back to the |
no test coverage detected