MCPcopy Create free account
hub / github.com/cloudflare/computer / normalizePath

Function normalizePath

packages/computer/src/backends/worker-shell/adapter.ts:325–337  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

323}
324
325function normalizePath(path: string): string {
326 const parts = path.split("/");
327 const stack: string[] = [];
328 for (const part of parts) {
329 if (part === "" || part === ".") continue;
330 if (part === "..") {
331 stack.pop();
332 continue;
333 }
334 stack.push(part);
335 }
336 return `/${stack.join("/")}`;
337}
338
339function createWorkspaceError(
340 code: string,

Callers 4

resolvePathMethod · 0.70
realpathMethod · 0.70
isDevDirFunction · 0.70
isDevNullFunction · 0.70

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected