path.ts ×6

Frontier kind: Code frontier

unlabeled · c_b04b04af743f

36 tests · 3523 LOC · 18 files · introduces 0 tests · 46 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges46 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
520 ranges3523 lines · 18 files · Browse complete extent
All tests (intent)
36 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 46 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/path.ts 46 introduced LOC · 6 ranges

Open complete file

468
469 join(...paths: string[]): string {
470 > if (paths.length === 0) { path.ts
471 return '.';
472 }
473 > path.ts
474 > let joined;
475 > let firstPart: string | undefined;
476 > for (let i = 0; i < paths.length; ++i) {
477 > const arg = paths[i];
478 > validateString(arg, 'path');
479 > if (arg.length > 0) {
480 > if (joined === undefined) {
481 > joined = firstPart = arg;
482 > }
483 > else {
484 > joined += `\\${arg}`;
485 > }
486 > }
487 > }
488 >
489 > if (joined === undefined) {
490 return '.';
491 }
492 > path.ts
493 > // Make sure that the joined path doesn't start with two slashes, because
494 > // normalize() will mistake it for a UNC path then.
495 > //
496 > // This step is skipped when it is very clear that the user actually
497 > // intended to point at a UNC path. This is assumed when the first
498 > // non-empty string arguments starts with exactly two slashes followed by
499 > // at least one more non-slash character.
500 > //
501 > // Note that for normalize() to treat a path as a UNC path it needs to
502 > // have at least 2 components, so we don't filter for that here.
503 > // This means that the user can use join to construct UNC paths from
504 > // a server name and a share name; for example:
505 > // path.join('//server', 'share') -> '\\\\server\\share\\')
506 > let needsReplace = true;
507 > let slashCount = 0;
508 > if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {
509 ++slashCount;
510 const firstLen = firstPart.length;
521 }
522 }
523 > if (needsReplace) { path.ts
524 > // Find any more consecutive slashes we need to replace
525 > while (slashCount < joined.length &&
526 > isPathSeparator(joined.charCodeAt(slashCount))) {
527 slashCount++;
528 }
529 > path.ts
530 > // Replace the slashes if needed
531 > if (slashCount >= 2) {
532 joined = `\\${joined.slice(slashCount)}`;
533 }
534 > } path.ts
535 >
536 > return win32.normalize(joined);
537 > },
538
539