mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
use electron builtin to open links (#897)
When opening a link on standalone, use [shell.openExternal](https://github.com/electron/electron/blob/master/docs/api/shell.md#shellopenexternalurl-options). This works cross-platform, and looks less suspicious to antivirus than explicitly shelling out.
This commit is contained in:
parent
1cd26f74b2
commit
b6e6970e0e
@ -4,7 +4,7 @@ const { app, BrowserWindow, Menu, MenuItem, session } = require("electron");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const childProcess = require("child_process");
|
||||
const { ipcMain } = require("electron");
|
||||
const { ipcMain, shell } = require("electron");
|
||||
const fs = require("fs");
|
||||
const isDev = process.argv.indexOf("--dev") >= 0;
|
||||
const isLocal = process.argv.indexOf("--local") >= 0;
|
||||
@ -67,11 +67,7 @@ function createWindow() {
|
||||
|
||||
win.webContents.on("new-window", (event, pth) => {
|
||||
event.preventDefault();
|
||||
if (process.platform == "win32") {
|
||||
childProcess.execSync("start " + pth);
|
||||
} else if (process.platform == "linux") {
|
||||
childProcess.execSync("xdg-open " + pth);
|
||||
}
|
||||
shell.openExternal(pth);
|
||||
});
|
||||
|
||||
win.on("closed", () => {
|
||||
|
Loading…
Reference in New Issue
Block a user