| 395 | } |
| 396 | |
| 397 | func getPathComponentsForWatching(path string, currentDirectory string) []string { |
| 398 | components := tspath.GetPathComponents(path, currentDirectory) |
| 399 | rootLength := perceivedOsRootLengthForWatching(components) |
| 400 | if rootLength <= 1 { |
| 401 | return components |
| 402 | } |
| 403 | newRoot := tspath.CombinePaths(components[0], components[1:rootLength]...) |
| 404 | return append([]string{newRoot}, components[rootLength:]...) |
| 405 | } |
| 406 | |
| 407 | func perceivedOsRootLengthForWatching(pathComponents []string) int { |
| 408 | length := len(pathComponents) |