Skip to content

Commit

Permalink
fix macos app exe path
Browse files Browse the repository at this point in the history
  • Loading branch information
xianyunleo committed Sep 24, 2024
1 parent 56738e5 commit 54f25fa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/utils/GetAppPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
WIN_CORE_PATH_NAME
} from '@/main/utils/constant'
import Path from '@/main/utils/Path'
import {APP_NAME} from "@/shared/utils/constant";

export default class GetAppPath {
static getDir() {
Expand All @@ -21,7 +22,18 @@ export default class GetAppPath {
* @returns {string}
*/
static getExePath() {
return process.execPath //同app.getPath('exe')
if (process.type === 'renderer') {
if (isWindows){
return process.execPath
}else if(isMacOS){
//Applications/EServer.app/Contents/Frameworks/EServer Helper (Renderer).app/Contents/MacOS/EServer Helper (Renderer)
return Path.Join(process.execPath,`../../../../../MacOS/${APP_NAME}`)
}
return ''
} else {
const { app } = require('electron')
return app.getPath('exe')
}
}

/**
Expand Down

0 comments on commit 54f25fa

Please sign in to comment.