mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
refactor: migrate src/global/index.ts from Bun.file() to Filesystem module (#14146)
This commit is contained in:
parent
be2e6f1926
commit
8bf06cbcc1
@ -2,6 +2,7 @@ import fs from "fs/promises"
|
||||
import { xdgData, xdgCache, xdgConfig, xdgState } from "xdg-basedir"
|
||||
import path from "path"
|
||||
import os from "os"
|
||||
import { Filesystem } from "../util/filesystem"
|
||||
|
||||
const app = "opencode"
|
||||
|
||||
@ -35,9 +36,7 @@ await Promise.all([
|
||||
|
||||
const CACHE_VERSION = "21"
|
||||
|
||||
const version = await Bun.file(path.join(Global.Path.cache, "version"))
|
||||
.text()
|
||||
.catch(() => "0")
|
||||
const version = await Filesystem.readText(path.join(Global.Path.cache, "version")).catch(() => "0")
|
||||
|
||||
if (version !== CACHE_VERSION) {
|
||||
try {
|
||||
@ -51,5 +50,5 @@ if (version !== CACHE_VERSION) {
|
||||
),
|
||||
)
|
||||
} catch (e) {}
|
||||
await Bun.file(path.join(Global.Path.cache, "version")).write(CACHE_VERSION)
|
||||
await Filesystem.write(path.join(Global.Path.cache, "version"), CACHE_VERSION)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user