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

Function inferPrimaryNotesLocation

apps/desktop/src/main/vault.ts:1091–1105  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

1089}
1090
1091async function inferPrimaryNotesLocation(root: string): Promise<PrimaryNotesLocation> {
1092 let entries: Dirent[]
1093 try {
1094 entries = await fs.readdir(root, { withFileTypes: true })
1095 } catch {
1096 return DEFAULT_VAULT_SETTINGS.primaryNotesLocation
1097 }
1098 for (const entry of entries) {
1099 if (entry.name.startsWith('.')) continue
1100 if (RESERVED_ROOT_NAMES.has(entry.name)) continue
1101 if (entry.isDirectory()) return 'root'
1102 if (entry.isFile() && entry.name.toLowerCase().endsWith('.md')) return 'root'
1103 }
1104 return DEFAULT_VAULT_SETTINGS.primaryNotesLocation
1105}
1106
1107/**
1108 * True when the vault is in `inbox` primary-notes mode but its root holds

Callers 3

getVaultSettingsFunction · 0.85
setVaultSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected