* The plain spelling of a Win32 namespace path: `\\?\C:\x` and `\\.\C:\x` are * `C:\x`, and `\\?\UNC\host\share` is `\\host\share`. `path.resolve` keeps the * prefix, so a string comparison would never see the folder behind it. Other * namespace paths (a `\\?\Volume{…}\` name, a device) are retur
(p: string)
| 261 | * the real path the caller also checks names their folder. |
| 262 | */ |
| 263 | function stripWin32NamespacePrefix(p: string): string { |
| 264 | if (process.platform !== 'win32') return p; |
| 265 | const prefix = /^[\\/]{2}[?.][\\/](UNC[\\/])?/i.exec(p); |
| 266 | if (!prefix) return p; |
| 267 | const rest = p.slice(prefix[0].length); |
| 268 | if (prefix[1]) return `\\\\${rest}`; |
| 269 | return /^[a-z]:[\\/]/i.test(rest) ? rest : p; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * The folder a path really names: links (symlinks, junctions, a `subst` drive) |
no test coverage detected