MCPcopy Index your code
hub / github.com/bytecodealliance/ComponentizeJS / maybeWindowsPath

Function maybeWindowsPath

src/platform.js:8–21  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

6
7/** Convert a path that to be usable on windows, if necessary */
8export function maybeWindowsPath(path) {
9 if (!path) return path;
10 const resolvedPath = resolve(path);
11 if (!IS_WINDOWS) return resolvedPath;
12
13 // Strip any existing UNC prefix check both the format we add as well as what
14 // the windows API returns when using path.resolve
15 let cleanPath = resolvedPath;
16 while (cleanPath.startsWith('\\\\?\\') || cleanPath.startsWith('//?/')) {
17 cleanPath = cleanPath.substring(4);
18 }
19
20 return '//?/' + cleanPath.replace(/\\/g, '/');
21}

Callers 2

componentizeFunction · 0.90
prepWorkDirFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected