-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
43 lines (35 loc) · 952 Bytes
/
Copy pathmain.js
File metadata and controls
43 lines (35 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//backend
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
const path = require('path');
const configPath = path.join(app.getPath('userData'), 'config.json');
app.setName("FileFlix");
function createWindow() {
const win = new BrowserWindow({
width: 1000,
height: 700,
icon: path.join(__dirname, 'img/FileFlix.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
sandbox: false
}
});
win.removeMenu();
win.loadFile('index.html');
//dev debug tools
//win.webContents.openDevTools();
}
app.whenReady().then(() => {
createWindow();
});
ipcMain.handle('select-folder', async () => {
const result = await dialog.showOpenDialog({
properties: ['openDirectory']
});
if (result.canceled) return null;
return result.filePaths[0];
});
ipcMain.handle('get-config-path', () => {
return configPath;
});