|
@@ -1,5 +1,5 @@
|
|
|
import fs from "fs/promises"
|
|
import fs from "fs/promises"
|
|
|
-import { xdgData, xdgCache, xdgConfig } from "xdg-basedir"
|
|
|
|
|
|
|
+import { xdgData, xdgCache, xdgConfig, xdgState } from "xdg-basedir"
|
|
|
import path from "path"
|
|
import path from "path"
|
|
|
|
|
|
|
|
const app = "opencode"
|
|
const app = "opencode"
|
|
@@ -7,6 +7,7 @@ const app = "opencode"
|
|
|
const data = path.join(xdgData!, app)
|
|
const data = path.join(xdgData!, app)
|
|
|
const cache = path.join(xdgCache!, app)
|
|
const cache = path.join(xdgCache!, app)
|
|
|
const config = path.join(xdgConfig!, app)
|
|
const config = path.join(xdgConfig!, app)
|
|
|
|
|
+const state = path.join(xdgState!, app)
|
|
|
|
|
|
|
|
export namespace Global {
|
|
export namespace Global {
|
|
|
export const Path = {
|
|
export const Path = {
|
|
@@ -15,12 +16,14 @@ export namespace Global {
|
|
|
providers: path.join(config, "providers"),
|
|
providers: path.join(config, "providers"),
|
|
|
cache,
|
|
cache,
|
|
|
config,
|
|
config,
|
|
|
|
|
+ state,
|
|
|
} as const
|
|
} as const
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
await Promise.all([
|
|
await Promise.all([
|
|
|
- fs.mkdir(data, { recursive: true }),
|
|
|
|
|
- fs.mkdir(config, { recursive: true }),
|
|
|
|
|
- fs.mkdir(cache, { recursive: true }),
|
|
|
|
|
|
|
+ fs.mkdir(Global.Path.data, { recursive: true }),
|
|
|
|
|
+ fs.mkdir(Global.Path.config, { recursive: true }),
|
|
|
|
|
+ fs.mkdir(Global.Path.cache, { recursive: true }),
|
|
|
fs.mkdir(Global.Path.providers, { recursive: true }),
|
|
fs.mkdir(Global.Path.providers, { recursive: true }),
|
|
|
|
|
+ fs.mkdir(Global.Path.state, { recursive: true }),
|
|
|
])
|
|
])
|