DisplayName returns a short, human-readable name for the project, relative to the given workspace root directory. For configured projects, this is the config file path made relative. For inferred projects, this is the last component of the current directory.
(cwd string)
| 176 | // For configured projects, this is the config file path made relative. |
| 177 | // For inferred projects, this is the last component of the current directory. |
| 178 | func (p *Project) DisplayName(cwd string) string { |
| 179 | if p.Kind == KindInferred { |
| 180 | return tspath.GetBaseFileName(p.currentDirectory) |
| 181 | } |
| 182 | return tspath.ConvertToRelativePath(p.configFileName, tspath.ComparePathsOptions{ |
| 183 | CurrentDirectory: cwd, |
| 184 | }) |
| 185 | } |
| 186 | |
| 187 | func (p *Project) ID() tspath.Path { |
| 188 | return p.configFilePath |