MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / formatPathForVm

Function formatPathForVm

src/debug/utils.ts:3–21  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

1import { forceWindowsDriveLetterToUppercase } from "../shared/utils/fs";
2
3export function formatPathForVm(file: string): string {
4 // Handle drive letter inconsistencies.
5 file = forceWindowsDriveLetterToUppercase(file);
6
7 // Convert any Windows backslashes to forward slashes.
8 file = file.replace(/\\/g, "/");
9
10 // Remove any existing file:/(//) prefixes.
11 file = file.replace(/^file:\/+/, ""); // TODO: Does this case ever get hit? Will it be over-encoded?
12
13 // Remove any remaining leading slashes.
14 file = file.replace(/^\/+/, "");
15
16 // Ensure a single slash prefix.
17 if (file.startsWith("dart:"))
18 return file;
19 else
20 return `file:///${encodeURI(file)}`;
21}

Callers 1

setBreakPointsRequestFunction · 0.90

Calls 1

Tested by

no test coverage detected