From 40a76948acc2f7961d842b28443bde2ba039ba2f Mon Sep 17 00:00:00 2001 From: pobb <79351885+1506086927@users.noreply.github.com> Date: Thu, 14 May 2026 16:35:56 +0800 Subject: [PATCH] Update cachePaths.ts --- src/utils/cachePaths.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/cachePaths.ts b/src/utils/cachePaths.ts index f66ed8d4..e221a9e7 100644 --- a/src/utils/cachePaths.ts +++ b/src/utils/cachePaths.ts @@ -3,7 +3,13 @@ import { join } from 'path' import { getFsImplementation } from './fsOperations.js' import { djb2Hash } from './hash.js' -const paths = envPaths('claude-cli') +// When CLAUDE_CONFIG_DIR is set (portable mode), place cache under it +// so the install is fully self-contained. Otherwise fall back to the +// system default (%LOCALAPPDATA%\claude-cli-nodejs\Cache on Windows). +const claudConfigDir = (process.env as Record).CLAUDE_CONFIG_DIR +const paths: { cache: string } = claudConfigDir + ? { cache: join(claudConfigDir, 'Cache') } + : envPaths('claude-cli') // Local sanitizePath using djb2Hash — NOT the shared version from // sessionStoragePortable.ts which uses Bun.hash (wyhash) when available.