* @param {string} path * @returns {string}
(path)
| 766 | * @returns {string} |
| 767 | */ |
| 768 | toNamespacedPath(path) { |
| 769 | // Note: this will *probably* throw somewhere. |
| 770 | if (typeof path !== 'string' || path.length === 0) |
| 771 | return path; |
| 772 | |
| 773 | const resolvedPath = win32.resolve(path); |
| 774 | |
| 775 | if (resolvedPath.length <= 2) |
| 776 | return path; |
| 777 | |
| 778 | if (StringPrototypeCharCodeAt(resolvedPath, 0) === CHAR_BACKWARD_SLASH) { |
| 779 | // Possible UNC root |
| 780 | if (StringPrototypeCharCodeAt(resolvedPath, 1) === CHAR_BACKWARD_SLASH) { |
| 781 | const code = StringPrototypeCharCodeAt(resolvedPath, 2); |
| 782 | if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { |
| 783 | // Matched non-long UNC root, convert the path to a long UNC path |
| 784 | return `\\\\?\\UNC\\${StringPrototypeSlice(resolvedPath, 2)}`; |
| 785 | } |
| 786 | } |
| 787 | } else if ( |
| 788 | isWindowsDeviceRoot(StringPrototypeCharCodeAt(resolvedPath, 0)) && |
| 789 | StringPrototypeCharCodeAt(resolvedPath, 1) === CHAR_COLON && |
| 790 | StringPrototypeCharCodeAt(resolvedPath, 2) === CHAR_BACKWARD_SLASH |
| 791 | ) { |
| 792 | // Matched device root, convert the path to a long UNC path |
| 793 | return `\\\\?\\${resolvedPath}`; |
| 794 | } |
| 795 | |
| 796 | return resolvedPath; |
| 797 | }, |
| 798 | |
| 799 | /** |
| 800 | * @param {string} path |
no test coverage detected
searching dependent graphs…