fix(BinaryLocator): Add filesystem fallback for validateBinaryExists when plugin unavailable
Improves binary validation by using fs.promises.access() as fallback when plugin context is not available, ensuring cross-platform binary detection works reliably. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 file changed
+5
-1
@@ -150,8 +150,12 @@ export class BinaryLocator {
|
|||||||
private static async validateBinaryExists(binaryPath: string, plugin?: obsidianTypstPDFExport): Promise<boolean> {
|
private static async validateBinaryExists(binaryPath: string, plugin?: obsidianTypstPDFExport): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
if (!plugin?.app) {
|
if (!plugin?.app) {
|
||||||
return false;
|
// This should not happen in normal plugin operation, but provide fallback
|
||||||
|
const fs = require('fs').promises;
|
||||||
|
await fs.access(binaryPath);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pathUtils = new PathUtils(plugin.app);
|
const pathUtils = new PathUtils(plugin.app);
|
||||||
return await pathUtils.fileExists(binaryPath);
|
return await pathUtils.fileExists(binaryPath);
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in new issue
Block a user