refs #2459 Fix icon path for tray and about window

This commit is contained in:
AkiraFukushima 2021-05-22 21:50:45 +09:00
parent 24a92cae5f
commit f8ca8827a7
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
4 changed files with 14 additions and 8 deletions

View File

@ -12,7 +12,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
let rendererConfig = {
devtool: 'eval-cheap-module-source-map',
entry: {
renderer: path.join(__dirname, '../src/renderer/main.ts')
},
@ -211,13 +210,13 @@ if (process.env.NODE_ENV !== 'production') {
__static: `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
})
)
rendererConfig.devtool = 'eval-cheap-module-source-map'
}
/**
* Adjust rendererConfig for production settings
*/
if (process.env.NODE_ENV === 'production') {
rendererConfig.devtool = ''
rendererConfig.mode = 'production'
rendererConfig.plugins.push(
new CopyWebpackPlugin({

View File

@ -11,7 +11,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
let webConfig = {
devtool: '#cheap-module-eval-source-map',
entry: {
web: path.join(__dirname, '../src/renderer/main.js')
},
@ -123,11 +122,14 @@ let webConfig = {
target: 'web'
}
if (process.env.NODE_ENV !== 'production') {
webConfig.devtool = 'eval-cheap-module-source-map'
}
/**
* Adjust webConfig for production settings
*/
if (process.env.NODE_ENV === 'production') {
webConfig.devtool = ''
webConfig.mode = 'production'
webConfig.plugins.push(
new CopyWebpackPlugin({

View File

@ -50,7 +50,8 @@
"output": "build"
},
"extraResources": [
"build/sounds/*"
"build/sounds/*",
"build/icons/*"
],
"files": [
"dist/electron/**/*",

View File

@ -151,6 +151,10 @@ const accountCache = new AccountCache(accountCachePath)
const soundBasePath =
process.env.NODE_ENV === 'development' ? path.join(__dirname, '../../build/sounds/') : path.join(process.resourcesPath!, 'build/sounds/')
const iconBasePath =
process.env.NODE_ENV === 'development'
? path.resolve(__dirname, '../../build/icons/')
: path.resolve(process.resourcesPath!, 'build/icons/')
let launcher: AutoLaunch | null = null
const proxyConfiguration = new ProxyConfiguration(preferencesDBPath)
@ -309,7 +313,7 @@ async function createWindow() {
height: mainWindowState.height,
backgroundColor: '#fff',
useContentSize: true,
icon: path.resolve(__dirname, '../../build/icons/256x256.png'),
icon: path.join(iconBasePath, '256x256.png'),
autoHideMenuBar: autoHideMenuBar,
webPreferences: {
// It is required to use ipcRenderer in renderer process.
@ -355,7 +359,7 @@ async function createWindow() {
// Show tray icon only linux and windows.
if (process.platform !== 'darwin') {
// Show tray icon
tray = new Tray(path.join(__dirname, '../../build/icons/tray_icon.png'))
tray = new Tray(path.join(iconBasePath, 'tray_icon.png'))
const trayMenu = TrayMenu(accountsChange, i18next)
tray.setContextMenu(trayMenu)
@ -1303,7 +1307,7 @@ const ApplicationMenu = (accountsChange: Array<MenuItemConstructorOptions>, menu
role: 'about',
click: () => {
openAboutWindow({
icon_path: path.resolve(__dirname, '../../build/icons/256x256.png'),
icon_path: path.join(iconBasePath, '256x256.png'),
copyright: 'Copyright (c) 2020 AkiraFukushima',
package_json_dir: path.resolve(__dirname, '../../'),
open_devtools: process.env.NODE_ENV !== 'production'