MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / normalizeWorkspaceRoot

Function normalizeWorkspaceRoot

src/utils/path-utils.ts:23–31  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

21};
22
23function normalizeWorkspaceRoot(root: string): string {
24 const trimmed = root.trim().replace(/\\/g, "/").replace(/\/+$/, "");
25 if (!trimmed) return "";
26 // Keep Windows drive roots (`C:` / `C:/repo`) and POSIX absolutes as-is.
27 if (trimmed.startsWith("/") || /^[A-Za-z]:(\/|$)/.test(trimmed)) {
28 return trimmed;
29 }
30 return `/${trimmed}`;
31}
32
33/**
34 * Convert an agent/chat file path into a workspace-relative path for the Files

Callers 1

toFilesTabPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected