MCPcopy
hub / github.com/AutoMaker-Org/automaker / electronUserDataWriteFileSync

Function electronUserDataWriteFileSync

libs/platform/src/system-paths.ts:756–769  ·  view source on GitHub ↗
(
  relativePath: string,
  data: string,
  options?: { encoding?: BufferEncoding; mode?: number }
)

Source from the content-addressed store, hash-verified

754 * Write a file to Electron userData directory
755 */
756export function electronUserDataWriteFileSync(
757 relativePath: string,
758 data: string,
759 options?: { encoding?: BufferEncoding; mode?: number }
760): void {
761 if (!electronUserDataPath) {
762 throw new Error('[SystemPaths] Electron userData path not initialized');
763 }
764 const fullPath = path.join(electronUserDataPath, relativePath);
765 // Ensure parent directory exists (may not exist on first launch)
766 const dir = path.dirname(fullPath);
767 fsSync.mkdirSync(dir, { recursive: true });
768 fsSync.writeFileSync(fullPath, data, options);
769}
770
771/**
772 * Check if a file exists in Electron userData directory

Callers 2

ensureApiKeyFunction · 0.90
saveWindowBoundsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected