This commit is contained in:
Muchen 2026-03-15 16:42:46 -06:00 committed by GitHub
commit fea2fec5de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -290,6 +290,22 @@ export function resolveConfigDir(
if (override) {
return resolveUserPath(override, env, homedir);
}
// If OPENCLAW_HOME is explicitly set, use it directly as the config directory.
// This prevents nested .openclaw/.openclaw when OPENCLAW_HOME already points to .openclaw.
const explicitHome = env.OPENCLAW_HOME?.trim();
if (explicitHome) {
const resolvedHome = resolveRequiredHomeDir(env, homedir);
try {
if (fs.existsSync(resolvedHome)) {
return resolvedHome;
}
} catch {
// best-effort
}
return resolvedHome;
}
const newDir = path.join(resolveRequiredHomeDir(env, homedir), ".openclaw");
try {
const hasNew = fs.existsSync(newDir);