mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-07 22:09:57 +00:00
Plugins: fix env-aware root resolution and caching (#44046)
Merged via squash.
Prepared head SHA: 6e8852a188
Co-authored-by: gumadeiras <5599352+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
688e3f0863
commit
e6897c800b
@@ -127,6 +127,15 @@ describe("resolveConfigDir", () => {
|
||||
await fs.promises.rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("expands OPENCLAW_STATE_DIR using the provided env", () => {
|
||||
const env = {
|
||||
HOME: "/tmp/openclaw-home",
|
||||
OPENCLAW_STATE_DIR: "~/state",
|
||||
} as NodeJS.ProcessEnv;
|
||||
|
||||
expect(resolveConfigDir(env)).toBe(path.resolve("/tmp/openclaw-home", "state"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveHomeDir", () => {
|
||||
@@ -214,6 +223,15 @@ describe("resolveUserPath", () => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("uses the provided env for tilde expansion", () => {
|
||||
const env = {
|
||||
HOME: "/tmp/openclaw-home",
|
||||
OPENCLAW_HOME: "/srv/openclaw-home",
|
||||
} as NodeJS.ProcessEnv;
|
||||
|
||||
expect(resolveUserPath("~/openclaw", env)).toBe(path.resolve("/srv/openclaw-home", "openclaw"));
|
||||
});
|
||||
|
||||
it("keeps blank paths blank", () => {
|
||||
expect(resolveUserPath("")).toBe("");
|
||||
expect(resolveUserPath(" ")).toBe("");
|
||||
|
||||
Reference in New Issue
Block a user