Skip to content

Commit

Permalink
fix: App Path definition
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Sep 16, 2024
1 parent 0037604 commit 85e0a39
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions electron/window.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import path from 'path'
import { app, BrowserWindow, ipcMain, Menu, Tray } from 'electron'
import { registerUpdaterEvents } from './updater'
import * as path from 'path'
import isDev from 'electron-is-dev'
import { URLSearchParams } from 'url'
import { main } from './main'
import * as isDev from 'electron-is-dev'
import { registerUpdaterEvents } from './updater'
import { getAppTitle, getIconByPlatform, onExit } from './helpers'
import { URLSearchParams } from 'url'
import { LauncherPaths } from './types'

export const createWindow = async (title: string, launcherPaths: LauncherPaths): Promise<BrowserWindow> => {
Expand All @@ -19,7 +19,7 @@ export const createWindow = async (title: string, launcherPaths: LauncherPaths):
nodeIntegrationInWorker: false,
nodeIntegrationInSubFrames: false,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js'),
preload: path.join(app.getAppPath(), '/preload/preload.cjs'),
webSecurity: true,
backgroundThrottling: false
}
Expand Down Expand Up @@ -52,7 +52,7 @@ export const createWindow = async (title: string, launcherPaths: LauncherPaths):

export const loadDefaultWeb = async (win: BrowserWindow) => {
main.isDefaultWeb = true
await win.loadURL(`file://${__dirname}/../../public/index.html#v${app.getVersion()}`)
await win.loadURL(`file://${app.getAppPath()}/index.html#v${app.getVersion()}`)
}

export const checkDeveloperConsole = (win: BrowserWindow) => {
Expand All @@ -65,7 +65,7 @@ export const checkDeveloperConsole = (win: BrowserWindow) => {

export const hideWindowInTray = (win: BrowserWindow) => {
if (main.tray == null) {
const iconPath = path.join(path.dirname(__dirname), '../public/systray', getIconByPlatform())
const iconPath = path.join(app.getAppPath(), 'systray', getIconByPlatform())

try {
main.tray = new Tray(iconPath)
Expand Down

0 comments on commit 85e0a39

Please sign in to comment.