-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.js
44 lines (36 loc) · 1.6 KB
/
core.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { app, Menu } = require('electron');
const path = require("path");
const fs = require('fs');
class Core {
constructor() {
return (async () => {
this.app = app;
global.app = app;
this.appReady = false;
this.ppapi_flash_path;
this.ppapi();
Menu.setApplicationMenu(Menu.buildFromTemplate([{ label: "File", submenu: [{ role: "reload" }, { role: "close" }] }]));
await this.app.whenReady();
this.appReady = true;
return this;
})()
}
ppapi() {
if (process.platform == 'win32') {
this.ppapi_flash_path = path.join(app.getAppPath(), '../flash/pepflashplayer.dll');
if (!fs.existsSync(this.ppapi_flash_path)) {
this.ppapi_flash_path = path.join(app.getAppPath(), './flash/pepflashplayer.dll');
}
} else if (process.platform == 'linux') {
this.ppapi_flash_path = path.join(process.resourcesPath.split("/")[1] === "tmp" ? process.resourcesPath : app.getAppPath(), './flash/libpepflashplayer.so');
this.app.commandLine.appendSwitch("--no-sandbox");
} else if (process.platform == 'darwin') {
this.ppapi_flash_path = path.join(app.getAppPath(), `../flash/PepperFlashPlayer.plugin`);
if (!fs.existsSync(this.ppapi_flash_path)) {
this.ppapi_flash_path = path.join(app.getAppPath(), './flash/PepperFlashPlayer.plugin');
}
}
this.app.commandLine.appendSwitch('ppapi-flash-path', this.ppapi_flash_path);
}
}
module.exports = Core;