修复无法获得pdf的问题
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user