(inputPath: string)
| 8 | * and will be treated as literal path segments by `resolvePathFromCwd`. |
| 9 | */ |
| 10 | export function expandHomePrefix(inputPath: string): string { |
| 11 | if (!inputPath) { |
| 12 | return inputPath; |
| 13 | } |
| 14 | |
| 15 | if (inputPath === '~') { |
| 16 | return homedir(); |
| 17 | } |
| 18 | |
| 19 | if (inputPath.startsWith('~/')) { |
| 20 | return path.join(homedir(), inputPath.slice(2)); |
| 21 | } |
| 22 | |
| 23 | return inputPath; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Resolve a user-supplied path: expand `~` then resolve against `cwd` |
no outgoing calls
no test coverage detected