fix: use STATE_DIR instead of hardcoded ~/.openclaw for identity and canvas (#4824)
* fix: use STATE_DIR instead of hardcoded ~/.openclaw for identity and canvas device-identity.ts and canvas-host/server.ts used hardcoded path.join(os.homedir(), '.openclaw', ...) ignoring OPENCLAW_STATE_DIR env var and the resolveStateDir() logic from config/paths.ts. This caused ~/.openclaw/identity and ~/.openclaw/canvas directories to be created even when state dir was overridden or resided elsewhere. * fix: format and remove duplicate imports * fix: scope state-dir patch + add regression tests (#4824) (thanks @kossoy) * fix: align state-dir fallbacks in hooks and agent paths (#4824) (thanks @kossoy) --------- Co-authored-by: Gustavo Madeira Santana <gumadeiras@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
resolveUpdateAvailability,
|
||||
} from "../commands/status.update.js";
|
||||
import { readConfigFileSnapshot, writeConfigFile } from "../config/config.js";
|
||||
import { resolveStateDir } from "../config/paths.js";
|
||||
import { resolveOpenClawPackageRoot } from "../infra/openclaw-root.js";
|
||||
import { trimLogTail } from "../infra/restart-sentinel.js";
|
||||
import { parseSemver } from "../infra/runtime-guard.js";
|
||||
@@ -126,7 +127,6 @@ const DEFAULT_PACKAGE_NAME = "openclaw";
|
||||
const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME]);
|
||||
const CLI_NAME = resolveCliName();
|
||||
const OPENCLAW_REPO_URL = "https://github.com/openclaw/openclaw.git";
|
||||
const DEFAULT_GIT_DIR = path.join(os.homedir(), ".openclaw");
|
||||
|
||||
function normalizeTag(value?: string | null): string | null {
|
||||
if (!value) {
|
||||
@@ -313,7 +313,7 @@ function resolveGitInstallDir(): string {
|
||||
}
|
||||
|
||||
function resolveDefaultGitDir(): string {
|
||||
return DEFAULT_GIT_DIR;
|
||||
return resolveStateDir(process.env, os.homedir);
|
||||
}
|
||||
|
||||
function resolveNodeRunner(): string {
|
||||
|
||||
Reference in New Issue
Block a user