(filePath: string)
| 153 | } |
| 154 | |
| 155 | export function getDisplayPath(filePath: string): string { |
| 156 | // Use relative path if file is in the current working directory |
| 157 | const { relativePath } = getAbsoluteAndRelativePaths(filePath) |
| 158 | if (relativePath && !relativePath.startsWith('..')) { |
| 159 | return relativePath |
| 160 | } |
| 161 | |
| 162 | // Use tilde notation for files in home directory |
| 163 | const homeDir = homedir() |
| 164 | if (filePath.startsWith(homeDir + sep)) { |
| 165 | return '~' + filePath.slice(homeDir.length) |
| 166 | } |
| 167 | |
| 168 | // Otherwise return the absolute path |
| 169 | return filePath |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Find files with the same name but different extensions in the same directory |
no test coverage detected