MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / searchDirectory

Function searchDirectory

contracts/scripts/util.ts:14–30  ·  view source on GitHub ↗
(currentPath)

Source from the content-addressed store, hash-verified

12 // This function checks each entry in the directory: if it's a file matching the filename, it returns its path.
13 // If it's a directory, the function recurses into it.
14 function searchDirectory(currentPath) {
15 const entries = fs.readdirSync(currentPath, { withFileTypes: true })
16
17 for (let entry of entries) {
18 const entryPath = path.join(currentPath, entry.name)
19
20 if (entry.isDirectory()) {
21 const result = searchDirectory(entryPath)
22 if (result) return result
23 } else if (entry.isFile() && entry.name === filename) {
24 return entryPath
25 }
26 }
27
28 // If no file is found, return null.
29 return null
30 }
31
32 return searchDirectory(folder)
33}

Callers 1

findFileInDirFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected