update getExe for linux
Some checks failed
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
parent 844007c5f6
commit d29ccbe0a6
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -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<ObsidianTestFixtures> = {