From d29ccbe0a679ee2a745fff81e093e0a121960528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 23 Oct 2024 04:00:02 -0400 Subject: [PATCH] update `getExe` for linux --- packages/obsidian-testing-framework/src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 = {