(path: string)
| 639 | }, |
| 640 | |
| 641 | toNamespacedPath(path: string): string { |
| 642 | // Note: this will *probably* throw somewhere. |
| 643 | if (typeof path !== 'string') { |
| 644 | return path; |
| 645 | } |
| 646 | |
| 647 | if (path.length === 0) { |
| 648 | return ''; |
| 649 | } |
| 650 | |
| 651 | const resolvedPath = win32.resolve(path); |
| 652 | |
| 653 | if (resolvedPath.length <= 2) { |
| 654 | return path; |
| 655 | } |
| 656 | |
| 657 | if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { |
| 658 | // Possible UNC root |
| 659 | if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { |
| 660 | const code = resolvedPath.charCodeAt(2); |
| 661 | if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { |
| 662 | // Matched non-long UNC root, convert the path to a long UNC path |
| 663 | return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; |
| 664 | } |
| 665 | } |
| 666 | } else if ( |
| 667 | isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) && |
| 668 | resolvedPath.charCodeAt(1) === CHAR_COLON && |
| 669 | resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH |
| 670 | ) { |
| 671 | // Matched device root, convert the path to a long UNC path |
| 672 | return `\\\\?\\${resolvedPath}`; |
| 673 | } |
| 674 | |
| 675 | return path; |
| 676 | }, |
| 677 | |
| 678 | dirname(path: string): string { |
| 679 | validateString(path, 'path'); |
nothing calls this directly
no test coverage detected