fix: different out path on macos

This commit is contained in:
linonetwo 2025-12-06 15:08:55 +08:00
parent 8a84d9b468
commit 126e7ec8d0

View file

@ -81,9 +81,12 @@ export const LOCALIZATION_FOLDER = isPackaged
// Default wiki locations
// For E2E tests, always use project root's wiki-test (outside asar)
// process.resourcesPath: out/TidGi-.../resources -> need ../../.. to get to project root
// Windows/Linux: process.resourcesPath = out/TidGi-.../resources -> need ../../.. (3 levels) to get to project root
// macOS: process.resourcesPath = out/TidGi-darwin-x64/TidGi.app/Contents/Resources -> need ../../../../../ (5 levels) to get to project root
export const DEFAULT_FIRST_WIKI_FOLDER_PATH = isTest && isPackaged
? path.resolve(process.resourcesPath, '..', '..', '..', testWikiFolderName) // E2E packaged: project root
? (isMac
? path.resolve(process.resourcesPath, '..', '..', '..', '..', '..', testWikiFolderName) // macOS E2E: 5 levels up
: path.resolve(process.resourcesPath, '..', '..', '..', testWikiFolderName)) // Windows/Linux E2E: 3 levels up
: isTest
? path.resolve(__dirname, '..', '..', testWikiFolderName) // E2E dev: project root
: isDevelopmentOrTest