fix: improve sidecar path lookup for dev environment

This commit is contained in:
xmk23333 2026-01-15 19:00:17 +08:00
parent 026d9d30f9
commit b071154263

View File

@ -48,10 +48,10 @@ function getResourcesPath() {
if (process.resourcesPath) { if (process.resourcesPath) {
return process.resourcesPath return process.resourcesPath
} }
// 开发环境:从 __dirname 向上查找项目根目录 // 开发环境:查找包含 extra/sidecar 的目录
let currentDir = __dirname let currentDir = __dirname
while (currentDir !== dirname(currentDir)) { while (currentDir !== dirname(currentDir)) {
if (existsSync(join(currentDir, 'package.json'))) { if (existsSync(join(currentDir, 'extra', 'sidecar'))) {
return currentDir return currentDir
} }
currentDir = dirname(currentDir) currentDir = dirname(currentDir)