(path: string)
| 196 | * given input and authority is undefined except for UNC paths. |
| 197 | */ |
| 198 | export function fromFsPath(path: string): [string, string] { |
| 199 | let authority: string; |
| 200 | if (isUNCShare(path)) { |
| 201 | [path, authority] = parseUNCShare(path); |
| 202 | } else if (hasDrive(path)) { |
| 203 | path = '/' + path[0].toUpperCase() + path.substring(1); |
| 204 | } else if (path[0] === '/' && hasDrive(path, 1)) { |
| 205 | // POSIX representation of a Windows path: just normalize drive letter case |
| 206 | path = '/' + path[1].toUpperCase() + path.substring(2); |
| 207 | } |
| 208 | |
| 209 | // Always normalize backslashes to forward slashes (filesystem → POSIX) |
| 210 | path = path.replace(/\\/g, '/'); |
| 211 | |
| 212 | return [path, authority]; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * Converts a POSIX path to a filesystem path. |
no test coverage detected