From 590a746b1ac674c81ea43bf352213362436d7493 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 21 Mar 2019 17:20:50 -0700 Subject: [PATCH] Fix autoupdate crash (nativeImage => NativeImage) #1425 --- app/src/browser/autoupdate-manager.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/browser/autoupdate-manager.ts b/app/src/browser/autoupdate-manager.ts index a81be1cff..ad8ae6a94 100644 --- a/app/src/browser/autoupdate-manager.ts +++ b/app/src/browser/autoupdate-manager.ts @@ -1,5 +1,5 @@ /* eslint global-require: 0*/ -import { dialog, NativeImage } from 'electron'; +import { dialog, nativeImage } from 'electron'; import { EventEmitter } from 'events'; import path from 'path'; import fs from 'fs'; @@ -161,12 +161,10 @@ export default class AutoUpdateManager extends EventEmitter { autoUpdater.quitAndInstall(); } - iconURL() { - const url = path.join(process.resourcesPath, 'static', 'images', 'mailspring.png'); - if (!fs.existsSync(url)) { - return undefined; - } - return url; + dialogIcon() { + const iconPath = path.join(global.application.resourcePath, 'static', 'images', 'mailspring.png'); + if (!fs.existsSync(iconPath)) return undefined; + return nativeImage.createFromPath(iconPath); } onUpdateNotAvailable = () => { @@ -174,7 +172,7 @@ export default class AutoUpdateManager extends EventEmitter { dialog.showMessageBox({ type: 'info', buttons: [localized('OK')], - icon: NativeImage.createFromPath(this.iconURL()), + icon: this.dialogIcon(), message: localized('No update available.'), title: localized('No update available.'), detail: localized(`You're running the latest version of Mailspring (%@).`, this.version), @@ -186,7 +184,7 @@ export default class AutoUpdateManager extends EventEmitter { dialog.showMessageBox({ type: 'warning', buttons: [localized('OK')], - icon: NativeImage.createFromPath(this.iconURL()), + icon: this.dialogIcon(), message: localized('There was an error checking for updates.'), title: localized('Update Error'), detail: message,