MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / tryGetRealPath

Function tryGetRealPath

src/platform/common/utils.node.ts:8–23  ·  view source on GitHub ↗
(expectedPath: Uri)

Source from the content-addressed store, hash-verified

6import { getOSType, OSType } from './utils/platform';
7
8export async function tryGetRealPath(expectedPath: Uri): Promise<Uri> {
9 try {
10 // Real path throws if the expected path is not actually created yet.
11 let realPath = await fsExtra.realpath(expectedPath.fsPath);
12
13 // Make sure on linux we use the correct separator
14 if (getOSType() != OSType.Windows) {
15 realPath = realPath.replace(/\\/g, '/');
16 }
17
18 return Uri.file(realPath);
19 } catch {
20 // So if that happens, just return the original path.
21 return expectedPath;
22 }
23}

Callers 3

getKernelSpecRootPathMethod · 0.90
getRuntimeDirImplMethod · 0.90

Calls 3

getOSTypeFunction · 0.90
replaceMethod · 0.45
fileMethod · 0.45

Tested by

no test coverage detected