fix: change the public path, fix image resource not loaded in production

This commit is contained in:
leejooy96 committed 2025-04-26 22:13:48 +09:00
1 parent 140d7a8f37
commit 0869610372
5 files changed
+10 -3

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
import { app, screen, Menu, Tray, BrowserWindow } from 'electron'
import Constants from './utils/Constants'
import { debounce } from './utils/Util'
import { join } from 'path'
let tray
let trayOptions
@@ -11,7 +12,7 @@ export function createTray(window: BrowserWindow, options) {
trayOptions.menu = false
}
tray = new Tray('buildAssets/icons/icon16.png')
tray = new Tray(join(Constants.PUBLIC_PATH, 'images/vutron-tray-icon.png'))
tray.setToolTip(trayOptions.tooltip)
if (trayOptions.menu) {
const contextMenu = Menu.buildFromTemplate([
+5 -1
View File
@@ -1,4 +1,4 @@
import { join, dirname } from 'path'
import { join, dirname, resolve } from 'path'
import { name, version, debug } from '../../../package.json'
import { fileURLToPath } from 'url'
@@ -21,6 +21,10 @@ export default class Constants {
static IS_DEV_ENV = process.env.NODE_ENV === 'development'
static PUBLIC_PATH = Constants.IS_DEV_ENV
? resolve(__dirname, '../../src/public')
: resolve(__dirname, '..')
// To show devtools at startup. It requires IS_DEV_ENV=true.
// Note: For debugging purpose, window won't be closed if click elsewhere, if devtools is open.
static IS_DEVTOOLS = true
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB