mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-03 07:55:05 +01:00
deal with non existing cache folder
This commit is contained in:
@@ -35,9 +35,11 @@ const version = await Bun.file(path.join(Global.Path.cache, "version"))
|
|||||||
.catch(() => "0")
|
.catch(() => "0")
|
||||||
|
|
||||||
if (version !== CACHE_VERSION) {
|
if (version !== CACHE_VERSION) {
|
||||||
const contents = await fs.readdir(Global.Path.cache)
|
try {
|
||||||
await Promise.all(
|
const contents = await fs.readdir(Global.Path.cache)
|
||||||
contents.map((item) => fs.rm(path.join(Global.Path.cache, item), { recursive: true, force: true })),
|
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)
|
await Bun.file(path.join(Global.Path.cache, "version")).write(CACHE_VERSION)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user