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

Function setVault

apps/desktop/src/main/index.ts:1277–1298  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

1275}
1276
1277async function setVault(root: string): Promise<VaultInfo> {
1278 const win = currentIpcWindow() ?? mainWindow
1279 if (win && !win.isDestroyed()) return await setVaultForWindow(win, root)
1280
1281 await ensureVaultLayout(root)
1282 const vault = vaultInfo(path.resolve(root))
1283 currentVault = vault
1284 currentWorkspaceMode = 'local'
1285 remoteWorkspaceClient = null
1286 remoteWorkspaceConfig = null
1287 currentRemoteWorkspaceProfileId = null
1288 remoteServerCapabilities = null
1289 stopRemoteWatch()
1290 await updateConfig((cfg) => ({
1291 ...cfg,
1292 workspaceMode: 'local',
1293 vaultRoot: vault.root,
1294 localVaults: rememberLocalVault(cfg.localVaults, vault),
1295 remoteWorkspaceProfileId: null
1296 }))
1297 return vault
1298}
1299
1300async function closeLocalVaultForWindow(): Promise<VaultInfo | null> {
1301 const win = currentIpcWindow() ?? mainWindow

Callers 4

closeLocalVaultForWindowFunction · 0.85
registerIpcFunction · 0.85

Calls 7

ensureVaultLayoutFunction · 0.90
vaultInfoFunction · 0.90
updateConfigFunction · 0.90
rememberLocalVaultFunction · 0.90
currentIpcWindowFunction · 0.85
setVaultForWindowFunction · 0.85
stopRemoteWatchFunction · 0.85

Tested by

no test coverage detected