MCPcopy Index your code
hub / github.com/nodejs/node / tryReadDirectory

Function tryReadDirectory

test/fixtures/snapshot/typescript.js:115262–115276  ·  view source on GitHub ↗

* If the readDirectory result was already cached, it returns that * Otherwise gets result from host and caches it. * The host request is done under try catch block to avoid caching incorrect result

(rootDir, rootDirPath)

Source from the content-addressed store, hash-verified

115260 * The host request is done under try catch block to avoid caching incorrect result
115261 */
115262 function tryReadDirectory(rootDir, rootDirPath) {
115263 rootDirPath = ts.ensureTrailingDirectorySeparator(rootDirPath);
115264 var cachedResult = getCachedFileSystemEntries(rootDirPath);
115265 if (cachedResult) {
115266 return cachedResult;
115267 }
115268 try {
115269 return createCachedFileSystemEntries(rootDir, rootDirPath);
115270 }
115271 catch (_e) {
115272 // If there is exception to read directories, dont cache the result and direct the calls to host
115273 ts.Debug.assert(!cachedReadDirectoryResult.has(ts.ensureTrailingDirectorySeparator(rootDirPath)));
115274 return undefined;
115275 }
115276 }
115277 function fileNameEqual(name1, name2) {
115278 return getCanonicalFileName(name1) === getCanonicalFileName(name2);
115279 }

Callers 3

getDirectoriesFunction · 0.85
readDirectoryFunction · 0.85
getFileSystemEntriesFunction · 0.85

Calls 5

tryIOAndConsumeErrorsFunction · 0.85
assertMethod · 0.80
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…