修复无法获得pdf的问题

This commit is contained in:
yhy
2026-08-30 09:02:11 +08:00
parent 455059eebe
commit af2ee38443
8 changed files with 151 additions and 49 deletions
@@ -7,25 +7,10 @@ import {
} from "../platform/paths";
function resolveProfileDir(): string {
const z = Zotero as any;
const candidates: unknown[] = [
z.Profile?.dir,
typeof z.getProfileDirectory === "function" ? z.getProfileDirectory() : undefined,
];
for (const candidate of candidates) {
const path =
typeof candidate === "string"
? candidate
: candidate &&
typeof candidate === "object" &&
"path" in candidate &&
typeof (candidate as { path: unknown }).path === "string"
? (candidate as { path: string }).path
: "";
if (path.trim()) return normalizeStoragePath(path.trim());
const dir = (Zotero as any).Profile?.dir;
if (typeof dir === "string" && dir.trim()) {
return dir.trim();
}
throw new Error("Cannot resolve Zotero profile directory");
}