MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / getNativeCacheBase

Function getNativeCacheBase

apps/kimi-code/src/native/native-assets.ts:137–156  ·  view source on GitHub ↗
(options: NativeAssetOptions = {})

Source from the content-addressed store, hash-verified

135}
136
137export function getNativeCacheBase(options: NativeAssetOptions = {}): string {
138 if (options.cacheBase !== undefined) return options.cacheBase;
139
140 const env = options.env ?? process.env;
141 const platform = options.platform ?? process.platform;
142 const home = options.homeDir ?? homedir();
143
144 const cacheDirEnv = optionalEnvValue(env, 'KIMI_CODE_CACHE_DIR');
145 if (cacheDirEnv !== null) return cacheDirEnv;
146
147 if (platform === 'darwin') return joinPosix(home, 'Library', 'Caches', 'kimi-code');
148 if (platform === 'win32') {
149 const localAppData = optionalEnvValue(env, 'LOCALAPPDATA');
150 return localAppData !== null
151 ? pathWin32.join(localAppData, 'kimi-code')
152 : pathWin32.join(home, 'AppData', 'Local', 'kimi-code', 'Cache');
153 }
154
155 return joinPosix(optionalEnvValue(env, 'XDG_CACHE_HOME') ?? joinPosix(home, '.cache'), 'kimi-code');
156}
157
158export function getNativeAssetCacheRoot(
159 manifest: NativeAssetManifest,

Callers 5

cache-base.test.tsFile · 0.90
getWebAssetCacheRootFunction · 0.90
getNativeAssetCacheRootFunction · 0.85

Calls 1

optionalEnvValueFunction · 0.85

Tested by

no test coverage detected