fix(whats-app): resolve OpenClaw paths and package resolution (#33)
This commit is contained in:
committed by
GitHub
Unverified
parent
518b5f6323
commit
a5ba7512a3
@@ -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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user