From 0c45fb58f04280681391e4704dc82191a9df5f7d Mon Sep 17 00:00:00 2001 From: truemiller <31908788+truemiller@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:27:01 +0100 Subject: [PATCH] chore: Remove unused code and update binary paths --- electron/install.js | 6 ++---- electron/main.js | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/electron/install.js b/electron/install.js index a02305c42..0eae86c3c 100644 --- a/electron/install.js +++ b/electron/install.js @@ -23,7 +23,6 @@ const TempDir = `${OperateDirectory}/temp`; const VersionFile = `${OperateDirectory}/version.txt`; const LogFile = `${OperateDirectory}/logs.txt`; const OperateInstallationLog = `${os.homedir()}/operate.log`; -const OperateCmd = `${process.env.PORTABLE_EXECUTABLE_DIR}./bins/pearl_${process.arch}`; const Env = { ...process.env, PATH: `${process.env.PATH}:/opt/homebrew/bin:/usr/local/bin`, @@ -354,8 +353,8 @@ async function setupDarwin(ipcChannel) { appendLog(`Upgrading pearl daemon to ${OlasMiddlewareVersion}`), ); writeVersion(); - removeLogF // reInstallOperatePackageUnix(OperateDirectory); -ile(); + removeLogFile(); + // reInstallOperatePackageUnix(OperateDirectory); } } @@ -447,7 +446,6 @@ module.exports = { startDocker, setupUbuntu, OperateDirectory, - OperateCmd, Env, appendLog, dirs: { diff --git a/electron/main.js b/electron/main.js index bdd75e55f..f9f50d250 100644 --- a/electron/main.js +++ b/electron/main.js @@ -40,19 +40,13 @@ if (!singleInstanceLock) app.quit(); const platform = os.platform(); const isDev = process.env.NODE_ENV === 'development'; -const cliPaths = { - prod: { - darwin: { - arm64: 'bins/pearl_arm64', - x64: 'bins/pearl_x64', - } - }, +const binaryPaths = { + darwin: { + arm64: 'bins/pearl_arm64', + x64: 'bins/pearl_x64', + }, }; -const cliPath = path.join(process.resourcesPath, cliPaths.prod[platform][process.arch.toString()]); - -console.log('CLI Path:', cliPath); - let appConfig = { ports: { dev: { @@ -303,7 +297,10 @@ async function launchDaemon() { const check = new Promise(function (resolve, _reject) { operateDaemon = spawn( - cliPath, + path.join( + process.resourcesPath, + binaryPaths.prod[platform][process.arch.toString()], + ), [ 'daemon', `--port=${appConfig.ports.prod.operate}`, @@ -652,4 +649,4 @@ ipcMain.handle('save-logs', async (_, data) => { if (debugDataFilePath) fs.unlinkSync(debugDataFilePath); return result; -}); \ No newline at end of file +});