( input: string, platform = process.platform, )
| 86 | } |
| 87 | |
| 88 | export function normalizeUserPathInput( |
| 89 | input: string, |
| 90 | platform = process.platform, |
| 91 | ): string { |
| 92 | const trimmedInput = input.trim(); |
| 93 | const unquotedInput = stripWrappingQuotes(trimmedInput); |
| 94 | const expandedInput = expandHomePath(unquotedInput); |
| 95 | |
| 96 | if (platform !== "win32") { |
| 97 | return expandedInput; |
| 98 | } |
| 99 | |
| 100 | for (const pattern of WINDOWS_DRIVE_PATH_PATTERNS) { |
| 101 | const match = expandedInput.match(pattern); |
| 102 | if (!match) { |
| 103 | continue; |
| 104 | } |
| 105 | |
| 106 | const [, driveLetter, rest] = match; |
| 107 | return `${driveLetter.toUpperCase()}:/${rest}`; |
| 108 | } |
| 109 | |
| 110 | return expandedInput; |
| 111 | } |
| 112 | |
| 113 | function isAbsoluteNormalizedUserPath( |
| 114 | input: string, |
no test coverage detected