(path)
| 6 | |
| 7 | /** Convert a path that to be usable on windows, if necessary */ |
| 8 | export function maybeWindowsPath(path) { |
| 9 | if (!path) return path; |
| 10 | const resolvedPath = resolve(path); |
| 11 | if (!IS_WINDOWS) return resolvedPath; |
| 12 | |
| 13 | // Strip any existing UNC prefix check both the format we add as well as what |
| 14 | // the windows API returns when using path.resolve |
| 15 | let cleanPath = resolvedPath; |
| 16 | while (cleanPath.startsWith('\\\\?\\') || cleanPath.startsWith('//?/')) { |
| 17 | cleanPath = cleanPath.substring(4); |
| 18 | } |
| 19 | |
| 20 | return '//?/' + cleanPath.replace(/\\/g, '/'); |
| 21 | } |
no outgoing calls
no test coverage detected