diff --git a/packages/obsidian-testing-framework/src/index.ts b/packages/obsidian-testing-framework/src/index.ts index 0a72835..c53808c 100644 --- a/packages/obsidian-testing-framework/src/index.ts +++ b/packages/obsidian-testing-framework/src/index.ts @@ -6,7 +6,7 @@ import path from "path"; import { extractAll } from "asar"; import { ObsidianTestFixtures } from "./fixtures.js"; import tmp from "tmp"; -import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs"; +import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs"; import { getApp, waitForIndexingComplete } from "./util.js"; export interface ObsidianTestingConfig { @@ -25,7 +25,11 @@ export function getExe(): string { if (process.platform == "darwin") { throw new Error("use a non-toy operating system, dumbass"); } - return execSync("/usr/lib/obsidian/obsidian.asar").toString(); + const possibleDirs = ["/opt/Obsidian", "/usr/lib/Obsidian", "/opt/obsidian", "/usr/lib/obsidian", "/var/lib/flatpak/app/md.obsidian.Obsidian/current/active/files", "/snap/obsidian/current"]; + for(let i = 0; i < possibleDirs.length; i++) { + if(existsSync(possibleDirs[i])) return path.join(possibleDirs[i], "resources", "obsidian.asar"); + } + return "" } const obsidianTestFixtures: Fixtures = {