From 0e777595e8dd36aa3fb050d23d7c16f46f44d35c Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Fri, 22 Sep 2017 19:21:11 +0200 Subject: [PATCH] Fix public path in packaged application --- main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 8073071..06b6b9a 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,7 @@ const {app, BrowserWindow, Tray, Menu} = require('electron'); const url = require('url'); const notifier = require('node-notifier'); +const path = require("path"); const gbs = require('./config/globals'); const core = require('./app/core'); @@ -8,12 +9,15 @@ const core = require('./app/core'); //Actual backend const backend = require('./app/backend'); +let logo = path.join(__dirname, 'public', 'logo.png'); +let logoGrey = path.join(__dirname, 'public', 'logo-grey.png'); + function createWindow () { // Create the browser window. gbs.win = new BrowserWindow({ width: 600, height: 250, - icon: "public/logo.png", + icon: logo, webPreferences: { //nodeIntegration: false }, @@ -41,7 +45,7 @@ function createWindow () { } function generateTray() { - gbs.tray = new Tray('public/logo.png'); + gbs.tray = new Tray(logo); gbs.trayMenu = Menu.buildFromTemplate([ { @@ -88,7 +92,7 @@ async function launch() { function updateTrayIcon() { console.log("Updating tray icon, connected: ", gbs.connected); - let path = gbs.connected ? 'public/logo.png' : 'public/logo-grey.png'; + let path = gbs.connected ? logo : logoGrey; gbs.tray.setImage(path); }