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

Function resolveActiveLocalVault

apps/desktop/src/main/index.ts:511–529  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

509// Pick a local vault to move an external file into: any open local
510// vault, else the active local vault, else the last-used vault on disk.
511async function resolveActiveLocalVault(): Promise<VaultInfo | null> {
512 for (const win of BrowserWindow.getAllWindows()) {
513 if (win.isDestroyed()) continue
514 if (windowVaults.modeForWindow(win.id) !== 'local') continue
515 const vault = windowVaults.vaultForWindow(win.id)
516 if (vault) return vault
517 }
518 if (currentVault && currentWorkspaceMode === 'local') return currentVault
519 const cfg = await loadConfig()
520 if (cfg.vaultRoot) {
521 try {
522 await ensureVaultLayout(cfg.vaultRoot)
523 return vaultInfo(path.resolve(cfg.vaultRoot))
524 } catch {
525 return null
526 }
527 }
528 return null
529}
530
531// Open a standalone editor window for a markdown file that lives outside
532// any vault. The window edits the file in place; the path is held here

Callers 1

registerIpcFunction · 0.85

Calls 5

loadConfigFunction · 0.90
ensureVaultLayoutFunction · 0.90
vaultInfoFunction · 0.90
modeForWindowMethod · 0.80
vaultForWindowMethod · 0.80

Tested by

no test coverage detected