-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
29 lines (25 loc) · 957 Bytes
/
main.js
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
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
const fs = require('fs');
const mkdirp = require('mkdirp');
const { toLocalStorage, toLocalStorageContent } = require('./src/config');
function createWindow () {
// Create the browser window.
mkdirp(toLocalStorageContent,err=>{
fs.access(toLocalStorage, fs.constants.R_OK | fs.constants.W_OK, (err) => {
if(err){
fs.writeFileSync(toLocalStorage,"path,class");
}
});
});
win = new BrowserWindow({width: 1200, height: 800, resizable: false});
win.webContents.openDevTools();
// 然后加载应用的 index.html。
win.loadURL(url.format({
pathname: process.env.NODE_ENV === "development" ? "localhost:3000":path.join(__dirname, 'build/index.html'),
protocol: 'http:',
slashes: true
}));
}
app.on('ready', createWindow);