jigefo3558/wordpress-time-machine-simulator
0
1```javascript2const { app, BrowserWindow, ipcMain, dialog } = require('electron');3const path = require('path');4const fs = require('fs');5 6let mainWindow;7 8function createWindow() {9 mainWindow = new BrowserWindow({10 width: 1200,11 height: 800,12 webPreferences: {13 nodeIntegration: true,14 contextIsolation: false,15 enableRemoteModule: true16 }17 });18 19 mainWindow.loadFile('index.html');20 21 mainWindow.on('closed', function () {22 mainWindow = null;23 });24}25 26app.on('ready', createWindow);27 28app.on('window-all-closed', function () {29 if (process.platform !== 'darwin') app.quit();30});31 32app.on('activate', function () {33 if (mainWindow === null) createWindow();34});35 36// Handle folder selection37ipcMain.on('open-folder-dialog', (event) => {38 dialog.showOpenDialog({39 properties: ['openDirectory']40 }).then(result => {41 if (!result.canceled) {42 event.sender.send('selected-folder', result.filePaths[0]);43 }44 });45});46```