* Expands tilde (~) at the start of a path to the user's home directory.
(filePath: string)
| 818 | * Expands tilde (~) at the start of a path to the user's home directory. |
| 819 | */ |
| 820 | function expandTilde(filePath: string): string { |
| 821 | if ( |
| 822 | filePath === '~' || |
| 823 | filePath.startsWith('~/') || |
| 824 | filePath.startsWith('~\\') |
| 825 | ) { |
| 826 | return homedir() + filePath.slice(1) |
| 827 | } |
| 828 | return filePath |
| 829 | } |
| 830 | |
| 831 | /** |
| 832 | * Checks the raw user-provided path (pre-realpath) for dangerous removal |
no outgoing calls
no test coverage detected