@@ -1,6 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import electron from "electron";
|
||||
import {spawn} from "child_process";
|
||||
|
||||
import ReactDevTools from "./reactdevtools";
|
||||
import * as IPCEvents from "common/constants/ipcevents";
|
||||
@@ -97,7 +98,8 @@ export default class BetterDiscord {
|
||||
electron.app.exit();
|
||||
}
|
||||
if (result.response === 1) {
|
||||
electron.shell.openPath(path.join(dataPath, "plugins"));
|
||||
if (process.platform === "win32") spawn("explorer.exe", [path.join(dataPath, "plugins")]);
|
||||
else electron.shell.openPath(path.join(dataPath, "plugins"));
|
||||
}
|
||||
});
|
||||
hasCrashed = false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {ipcMain as ipc, BrowserWindow, app, dialog, systemPreferences} from "electron";
|
||||
import {spawn} from "child_process";
|
||||
import {ipcMain as ipc, BrowserWindow, app, dialog, systemPreferences, shell} from "electron";
|
||||
|
||||
import * as IPCEvents from "common/constants/ipcevents";
|
||||
|
||||
@@ -32,6 +33,11 @@ const getPath = (event, pathReq) => {
|
||||
event.returnValue = returnPath;
|
||||
};
|
||||
|
||||
const openPath = (event, path) => {
|
||||
if (process.platform === "win32") spawn("explorer.exe", [path]);
|
||||
else shell.openPath(path);
|
||||
};
|
||||
|
||||
const relaunch = () => {
|
||||
app.quit();
|
||||
app.relaunch();
|
||||
@@ -140,6 +146,7 @@ export default class IPCMain {
|
||||
static registerEvents() {
|
||||
try {
|
||||
ipc.on(IPCEvents.GET_PATH, getPath);
|
||||
ipc.on(IPCEvents.OPEN_PATH, openPath);
|
||||
ipc.on(IPCEvents.RELAUNCH, relaunch);
|
||||
ipc.on(IPCEvents.OPEN_DEVTOOLS, openDevTools);
|
||||
ipc.on(IPCEvents.CLOSE_DEVTOOLS, closeDevTools);
|
||||
|
||||
@@ -19,7 +19,8 @@ module.exports = (env, argv) => ({
|
||||
rimraf: `require("rimraf")`,
|
||||
yauzl: `require("yauzl")`,
|
||||
mkdirp: `require("mkdirp")`,
|
||||
module: `require("module")`
|
||||
module: `require("module")`,
|
||||
child_process: `require("child_process")`,
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".js"],
|
||||
|
||||
Reference in New Issue
Block a user