MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / resolveDirDescent

Function resolveDirDescent

apps/desktop/src/main/vault.ts:2043–2063  ·  view source on GitHub ↗
(
  full: string,
  entry: Dirent,
  parentReal: string,
  ancestors: Set<string>
)

Source from the content-addressed store, hash-verified

2041// ancestor on the current path — that's a cycle (a link back into the
2042// vault, or an external loop) that would otherwise recurse forever.
2043async function resolveDirDescent(
2044 full: string,
2045 entry: Dirent,
2046 parentReal: string,
2047 ancestors: Set<string>
2048): Promise<string | null> {
2049 let real: string
2050 if (entry.isDirectory()) {
2051 real = path.join(parentReal, entry.name)
2052 } else if (entry.isSymbolicLink()) {
2053 try {
2054 if (!(await fs.stat(full)).isDirectory()) return null
2055 real = await fs.realpath(full)
2056 } catch {
2057 return null
2058 }
2059 } else {
2060 return null
2061 }
2062 return ancestors.has(real) ? null : real
2063}
2064
2065async function collectBuiltinSearchCandidates(root: string): Promise<VaultTextSearchCandidate[]> {
2066 const files: Array<{ full: string; folder: NoteFolder }> = []

Callers 2

walkFolderFunction · 0.85
walkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected