MapDownload-24.12.5-587/packages/main/index.js

20 lines
629 B
JavaScript

const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const fs = require('fs');
function createWindow() {
// Your window creation code
}
app.whenReady().then(() => {
const mainWindow = createWindow();
// Add IPC listeners here
ipcMain.on('get-path-join', (event, ...args) => {
event.returnValue = path.join(...args);
});
ipcMain.handle('fs-exists', (_, filePath) => fs.existsSync(filePath));
ipcMain.handle('fs-read', (_, filePath) => fs.readFileSync(filePath, 'utf-8'));
ipcMain.handle('fs-write', (_, filePath, content) => fs.writeFileSync(filePath, content));
});