From d0c08ccd97251121120255e898c5aefe460d4007 Mon Sep 17 00:00:00 2001 From: NaiboWang-Alienware Date: Tue, 7 Feb 2023 17:25:08 +0800 Subject: [PATCH] Multi-Platform Support --- ElectronJS/main.js | 10 +++++++++- ExecuteStage/easyspider_executestage.py | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ElectronJS/main.js b/ElectronJS/main.js index dc84810..3fcd19d 100644 --- a/ElectronJS/main.js +++ b/ElectronJS/main.js @@ -10,6 +10,14 @@ if (process.platform === 'win32' || process.platform === 'win64') { driverPath = path.join(__dirname, "chrome_win32/chromedriver_win32.exe"); chromeBinaryPath = path.join(__dirname, "chrome_win32/chrome.exe"); execute_path = path.join(__dirname, "chrome_win32/execute.bat"); +} else if (process.platform === 'darwin') { + driverPath = path.join(__dirname, "chrome_mac/chromedriver"); + chromeBinaryPath = path.join(__dirname, "chrome_mac/Chromium.app/Contents/MacOS/Chromium"); + execute_path = path.join(__dirname, "chrome_mac/execute.sh"); +} else if (process.platform === 'linux') { + driverPath = path.join(__dirname, "chrome_linux/chromedriver"); + chromeBinaryPath = path.join(__dirname, "chrome_linux/chrome"); + execute_path = path.join(__dirname, "chrome_linux/execute.sh"); } let server_address = "https://servicewrapper.systems"; @@ -146,7 +154,7 @@ function handleOpenBrowser(event) { const win = BrowserWindow.fromWebContents(webContents); runBrowser(); flowchart_window = new BrowserWindow({ - width: 1440, + width: 1600, height: 900, icon: iconPath, }); diff --git a/ExecuteStage/easyspider_executestage.py b/ExecuteStage/easyspider_executestage.py index d607a22..fee5da3 100644 --- a/ExecuteStage/easyspider_executestage.py +++ b/ExecuteStage/easyspider_executestage.py @@ -680,8 +680,8 @@ if __name__ == '__main__': driver_path = os.path.join( os.getcwd(), "EasySpider/resources/app/chrome_win32/chromedriver_win32.exe") elif sys.platform == "linux" and platform.architecture()[0] == "64bit": - options.binary_location = "EasySpider/chrome_linux64/chrome" - driver_path = "EasySpider/chrome_linux64/chromedriver_linux64" + options.binary_location = "EasySpider/resources/app/chrome_linux64/chrome" + driver_path = "EasySpider/resources/app/chrome_linux64/chromedriver_linux64" elif sys.platform == "darwin" and platform.architecture()[0] == "64bit": options.binary_location = "EasySpider/chrome_mac64/chrome" driver_path = "EasySpider/chrome_mac64/chromedriver_mac64"