mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:54:31 +00:00
fix: resolve symlinked argv1 for Control UI asset detection (#14919)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 07b85041dc
Co-authored-by: gumadeiras <116837+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
bdd0c12329
commit
8d5094e1f4
@@ -60,6 +60,18 @@ function findPackageRootSync(startDir: string, maxDepth = 12): string | null {
|
||||
function candidateDirsFromArgv1(argv1: string): string[] {
|
||||
const normalized = path.resolve(argv1);
|
||||
const candidates = [path.dirname(normalized)];
|
||||
|
||||
// Resolve symlinks for version managers (nvm, fnm, n, Homebrew/Linuxbrew)
|
||||
// that create symlinks in bin/ pointing to the real package location.
|
||||
try {
|
||||
const resolved = fsSync.realpathSync(normalized);
|
||||
if (resolved !== normalized) {
|
||||
candidates.push(path.dirname(resolved));
|
||||
}
|
||||
} catch {
|
||||
// realpathSync throws if path doesn't exist; keep original candidates
|
||||
}
|
||||
|
||||
const parts = normalized.split(path.sep);
|
||||
const binIndex = parts.lastIndexOf(".bin");
|
||||
if (binIndex > 0 && parts[binIndex - 1] === "node_modules") {
|
||||
|
||||
Reference in New Issue
Block a user