MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / stats

Method stats

Extension/src/Utility/Filesystem/filepath.ts:58–72  ·  view source on GitHub ↗
(name: string | undefined | Promise<string | undefined>, baseFolder?: string)

Source from the content-addressed store, hash-verified

56// eslint-disable-next-line @typescript-eslint/naming-convention
57export class filepath {
58 static async stats(name: string | undefined | Promise<string | undefined>, baseFolder?: string): Promise<[string, Stats | undefined] | [undefined, undefined]> {
59 if (is.promise(name)) {
60 name = await name;
61 }
62
63 // if the value isn't a string or has a newline, it ain't a file name
64 if (!name || name.indexOf('\n') !== -1) {
65 return [undefined, undefined];
66 }
67
68 // if we've been given a baseFolder, expand that, otherwise just normalize the value.
69 name = baseFolder ? resolve(baseFolder, name) : normalize(name);
70
71 return [name, await stat(name).catch(returns.undefined)];
72 }
73
74 static async info(name: string | undefined | Promise<string | undefined>, baseFolder?: string, executableExtensions: Set<string> = process.platform === 'win32' ? new Set(['.exe'/* ,'.cmd','.bat' */]) : new Set()): Promise<undefined | File | Folder> {
75 const [fullPath, stats] = await filepath.stats(name, baseFolder);

Callers 4

infoMethod · 0.80
isFileMethod · 0.80
isFolderMethod · 0.80
existsMethod · 0.80

Calls 2

promiseMethod · 0.80
catchMethod · 0.45

Tested by

no test coverage detected