(
relativePath: string,
data: string,
options?: { encoding?: BufferEncoding; mode?: number }
)
| 754 | * Write a file to Electron userData directory |
| 755 | */ |
| 756 | export 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 |
no outgoing calls
no test coverage detected