The open source coding agent.
TypeScript
deal with non existing cache folder
Dax Raad08c5c401ba0e
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.tsindex 5fdbf78cea5..4ebea7c66d4 100644--- a/packages/opencode/src/global/index.ts+++ b/packages/opencode/src/global/index.ts@@ -35,9 +35,11 @@ const version = await Bun.file(path.join(Global.Path.cache, "version")).catch(() => "0")if (version !== CACHE_VERSION) {- 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 })),- )+ try {+ 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 })),+ )+ } catch (e) {}await Bun.file(path.join(Global.Path.cache, "version")).write(CACHE_VERSION)}