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

Function statSyncSafe

src/shared/utils/fs.ts:160–169  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

158}
159
160function statSyncSafe(file: string): fs.Stats | undefined {
161 try {
162 return fs.statSync(file, { throwIfNoEntry: false });
163 } catch {
164 // Although I can't repro on any OS, some users see ENOTDIR if the path
165 // looks like `/path/to/file.dart/foo` which is possible because of
166 // how we call some of the helpers.
167 return undefined;
168 }
169}
170
171export function existsAndIsFileSync(file: string): boolean {
172 const stat = statSyncSafe(file);

Callers 2

existsAndIsFileSyncFunction · 0.85
existsAndIsDirectorySyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected