diff options
| author | Denys Pavlov <[email protected]> | 2025-08-21 11:25:45 -0400 |
|---|---|---|
| committer | opencode <[email protected]> | 2025-08-21 15:27:25 +0000 |
| commit | 2ff4cd2c2b30f6702548cb66950a643b5a458572 (patch) | |
| tree | e54550d606a86c6c8ef293422a11f4067bd72e52 | |
| parent | d686269377c19cefaa9b5958b148fdad1f62f3d1 (diff) | |
| download | opencode-2ff4cd2c2b30f6702548cb66950a643b5a458572.tar.gz opencode-2ff4cd2c2b30f6702548cb66950a643b5a458572.zip | |
fix: preserve cache dir on cleanup (#2126)
| -rw-r--r-- | packages/opencode/src/global/index.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.ts index 4fb1a5ade..5fdbf78ce 100644 --- a/packages/opencode/src/global/index.ts +++ b/packages/opencode/src/global/index.ts @@ -35,6 +35,9 @@ const version = await Bun.file(path.join(Global.Path.cache, "version")) .catch(() => "0") if (version !== CACHE_VERSION) { - await fs.rm(Global.Path.cache, { recursive: true, force: true }) + const contents = await fs.readdir(Global.Path.cache) + await Promise.all( + contents.map((item) => fs.rm(path.join(Global.Path.cache, item), { recursive: true, force: true })), + ) await Bun.file(path.join(Global.Path.cache, "version")).write(CACHE_VERSION) } |
