summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-21 22:58:39 -0400
committerDax Raad <[email protected]>2025-08-21 22:58:39 -0400
commit08c5c401ba0e415f2bfedd6aecfd7259a7b37a5d (patch)
tree1ee4a8da1ac1da7ac31f563913b619e024bdd2e3 /packages
parentba2e86c7efdafc93616147dbf8576fac18ddcbe8 (diff)
downloadopencode-08c5c401ba0e415f2bfedd6aecfd7259a7b37a5d.tar.gz
opencode-08c5c401ba0e415f2bfedd6aecfd7259a7b37a5d.zip
deal with non existing cache folder
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/global/index.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.ts
index 5fdbf78ce..4ebea7c66 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)
}