(root: string)
| 1089 | } |
| 1090 | |
| 1091 | async 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 |
no outgoing calls
no test coverage detected