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

Function listOverrides

apps/desktop/src/main/overrides.ts:122–146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120
121/** Read every `*.css` in the overrides dir into a Override (raw text). */
122export async function listOverrides(): Promise<Override[]> {
123 const dir = getOverridesDir()
124 let entries: string[]
125 try {
126 entries = await fs.readdir(dir)
127 } catch {
128 return []
129 }
130 const overrides: Override[] = []
131 for (const entry of entries) {
132 if (!entry.toLowerCase().endsWith('.css')) continue
133 try {
134 const css = await fs.readFile(path.join(dir, entry), 'utf8')
135 overrides.push({ name: entry, css })
136 } catch (err) {
137 overrides.push({
138 name: entry,
139 css: '',
140 error: err instanceof Error ? err.message : 'Could not read this override.'
141 })
142 }
143 }
144 overrides.sort((a, b) => a.name.localeCompare(b.name))
145 return overrides
146}
147
148let watcher: ReturnType<typeof chokidar.watch> | null = null
149

Callers 3

registerIpcFunction · 0.90
overrides.test.tsFile · 0.90
fireFunction · 0.85

Calls 1

getOverridesDirFunction · 0.85

Tested by

no test coverage detected