MCPcopy Create free account
hub / github.com/cortexkit/magic-context / ensureDir

Function ensureDir

packages/plugin/src/shared/logger.ts:19–29  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

17let lastEnsuredDir: string | null = null;
18
19function ensureDir(filePath: string): void {
20 const dir = path.dirname(filePath);
21 if (dir === lastEnsuredDir) return;
22 try {
23 fs.mkdirSync(dir, { recursive: true });
24 lastEnsuredDir = dir;
25 } catch {
26 // Intentional: logging must never throw. If mkdir fails we still
27 // try the append; failure there is also swallowed.
28 }
29}
30
31function flush(): void {
32 if (flushTimer) {

Callers 1

flushFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected