MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / toNamespacedPath

Function toNamespacedPath

src/platform/vscode-path/path.ts:641–676  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

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');

Callers

nothing calls this directly

Calls 2

isWindowsDeviceRootFunction · 0.85
resolveMethod · 0.65

Tested by

no test coverage detected