| 1 | package main |
| 2 | |
| 3 | // registerProjectRoot indexes workspaceRoot, realigns open tabs to its |
| 4 | // canonical spelling, and discovers existing sessions once per process. |
| 5 | func (a *App) registerProjectRoot(workspaceRoot string) { |
| 6 | _ = addProject(workspaceRoot, "") |
| 7 | a.syncTabWorkspaceRootSpellings() |
| 8 | root := normalizeProjectRoot(workspaceRoot) |
| 9 | if root == "" { |
| 10 | return |
| 11 | } |
| 12 | registrationKey := projectRootKey(root) |
| 13 | if _, loaded := a.catalogRegisteredProjectRoots.LoadOrStore(registrationKey, struct{}{}); loaded { |
| 14 | return |
| 15 | } |
| 16 | if !a.requestSessionCatalogReconcile(desktopSessionDir(root)) { |
| 17 | a.catalogRegisteredProjectRoots.Delete(registrationKey) |
| 18 | } |
| 19 | } |
| 20 |