From 634ecb11ff8bb6706002f31dfe5824f0bc246798 Mon Sep 17 00:00:00 2001 From: Mateo Miccino Date: Tue, 26 Apr 2022 11:49:20 -0300 Subject: [PATCH] fix: check if executable no exists and report that error (#59) * fix: check if executable no exists and report that error * update version --- electron/updater.ts | 22 +++++++++++++--------- package.json | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/electron/updater.ts b/electron/updater.ts index 5cf73f6..09500d1 100644 --- a/electron/updater.ts +++ b/electron/updater.ts @@ -141,15 +141,19 @@ const registerExecuteProcessEvent = (rendererPath: string, executablePath: strin console.log(`Execute path: ${path} params: ${params}`) - const { execFile } = require('child_process') - if (getOSName() === 'mac') { - params = ['-W', path, '--args', ...params] - execFile('open', params, onProcessFinish) + if (fs.existsSync(path)) { + const { execFile } = require('child_process') + if (getOSName() === 'mac') { + params = ['-W', path, '--args', ...params] + execFile('open', params, onProcessFinish) + } else { + execFile(path, params, onProcessFinish) + } + + ipcMain.emit('on-open-renderer', event) } else { - execFile(path, params, onProcessFinish) + await reportFatalError(event.sender, `Renderer not found: ${path}`) } - - ipcMain.emit('on-open-renderer', event) } catch (e) { console.error('Execute error: ', e) await reportFatalError(event.sender, JSON.stringify(e)) @@ -198,13 +202,13 @@ const registerDownloadEvent = (win: BrowserWindow, launcherPaths: LauncherPaths) const path = branchPath + launcherPaths.versionPath fs.writeFileSync(path, JSON.stringify(versionData)) + + event.sender.send('downloadState', { type: 'READY' }) }) } }) console.log('Res: ', res) console.log('Done!') - - event.sender.send('downloadState', { type: 'READY' }) }) } diff --git a/package.json b/package.json index a9c26b0..5002d2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "explorer-desktop-launcher", - "version": "0.1.36", + "version": "0.1.37", "author": "decentraland", "description": "Decentraland Desktop Launcher", "homepage": ".",