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

Function resolvePaths

src/shared/vscode/utils.ts:47–63  ·  view source on GitHub ↗
(p: T)

Source from the content-addressed store, hash-verified

45 && (!dartExtension || dartExtension.extensionKind === ExtensionKind.UI);
46
47export function resolvePaths<T extends string | undefined>(p: T): string | (undefined extends T ? undefined : never) {
48 if (typeof p !== "string")
49 return undefined as (undefined extends T ? undefined : never);
50
51 if (p.startsWith("~/"))
52 return path.join(os.homedir(), p.substr(2));
53 if (!path.isAbsolute(p)) {
54 const relativePathBase = workspace.workspaceFile?.scheme === "file"
55 ? path.dirname(fsPath(workspace.workspaceFile))
56 : workspace.workspaceFolders?.length
57 ? fsPath(workspace.workspaceFolders[0].uri)
58 : undefined;
59 if (relativePathBase)
60 return path.join(relativePathBase, p);
61 }
62 return p;
63}
64
65export function getDartWorkspaceFolders(): WorkspaceFolder[] {
66 if (!workspace.workspaceFolders)

Callers 15

util.test.tsFile · 0.90
analyzerLogFileMethod · 0.90
analyzerPathMethod · 0.90
customDartDapPathMethod · 0.90
customFlutterDapPathMethod · 0.90
dapLogFileMethod · 0.90
devToolsLogFileMethod · 0.90
mcpServerLogFileMethod · 0.90
extensionLogFileMethod · 0.90
flutterDaemonLogFileMethod · 0.90
flutterScreenshotPathMethod · 0.90

Calls 1

fsPathFunction · 0.90

Tested by

no test coverage detected