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

Function setPortableConfig

apps/desktop/src/main/app-config.ts:636–654  ·  view source on GitHub ↗
(partial: AppConfigPortable)

Source from the content-addressed store, hash-verified

634
635/** Merge a partial portable config into the cache and persist it atomically. */
636export function setPortableConfig(partial: AppConfigPortable): Promise<void> {
637 cache = { ...cache, ...partial }
638 const text = serializeConfig(cache)
639 writeQueue = writeQueue
640 .catch(() => {})
641 .then(async () => {
642 if (text === lastKnownText) return
643 // Set before writing so the watcher event this triggers is recognized
644 // as our own and ignored.
645 lastKnownText = text
646 rememberOwnWrite(text)
647 try {
648 await writeFileAtomic(getConfigFilePath(), text)
649 } catch (err) {
650 console.error('Failed to write config.toml', err)
651 }
652 })
653 return writeQueue
654}
655
656/** Ensure the file exists on disk (writing the current cache if missing) and
657 * return its path. Used by the "Reveal config file" action. */

Callers 3

registerIpcFunction · 0.90
app-config.test.tsFile · 0.90
ensureConfigFileFunction · 0.85

Calls 4

writeFileAtomicFunction · 0.90
serializeConfigFunction · 0.85
rememberOwnWriteFunction · 0.85
getConfigFilePathFunction · 0.85

Tested by

no test coverage detected