fix(whats-app): resolve OpenClaw paths and package resolution (#33)

This commit is contained in:
DigHuang
2026-02-10 00:21:00 -08:00
committed by GitHub
Unverified
parent 518b5f6323
commit a5ba7512a3
3 changed files with 41 additions and 14 deletions

View File

@@ -5,7 +5,7 @@
import { app } from 'electron';
import { join } from 'path';
import { homedir } from 'os';
import { existsSync, mkdirSync, readFileSync } from 'fs';
import { existsSync, mkdirSync, readFileSync, realpathSync } from 'fs';
import { logger } from './logger';
/**
@@ -85,6 +85,22 @@ export function getOpenClawDir(): string {
return join(__dirname, '../../node_modules/openclaw');
}
/**
* Get OpenClaw package directory resolved to a real path.
* Useful when consumers need deterministic module resolution under pnpm symlinks.
*/
export function getOpenClawResolvedDir(): string {
const dir = getOpenClawDir();
if (!existsSync(dir)) {
return dir;
}
try {
return realpathSync(dir);
} catch {
return dir;
}
}
/**
* Get OpenClaw entry script path (openclaw.mjs)
*/