MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / joinPath

Function joinPath

packages/filesystem/utils.ts:1–25  ·  view source on GitHub ↗
(...paths: string[])

Source from the content-addressed store, hash-verified

1export function joinPath(...paths: string[]): string {
2 let result = "";
3
4 for (const path of paths) {
5 if (!path) {
6 continue;
7 }
8
9 let start = 0;
10
11 for (let i = 0; i <= path.length; i++) {
12 if (i !== path.length && path[i] !== "/") {
13 continue;
14 }
15
16 if (i > start) {
17 result += `/${path.slice(start, i)}`;
18 }
19
20 start = i + 1;
21 }
22 }
23
24 return result;
25}

Callers 15

utils.test.tsFile · 0.90
readMethod · 0.90
openDirMethod · 0.90
createMethod · 0.90
createDirMethod · 0.90
deleteMethod · 0.90
openMethod · 0.90
openDirMethod · 0.90
createMethod · 0.90
createDirMethod · 0.90
deleteMethod · 0.90

Calls 1

sliceMethod · 0.45

Tested by

no test coverage detected