mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
Merge 29c1bde5f1 into 83397ebde2
This commit is contained in:
commit
d802de53ce
1 changed files with 10 additions and 1 deletions
|
|
@ -6,7 +6,15 @@ import os from "os"
|
|||
const app = "opencode"
|
||||
|
||||
const data = path.join(xdgData!, app)
|
||||
const cache = path.join(xdgCache!, app)
|
||||
// Fix xdgCache bug on macOS where it returns /home/ instead of /Users/
|
||||
const cacheBase = (() => {
|
||||
const isMacOS = os.platform() === "darwin"
|
||||
if (isMacOS && xdgCache && xdgCache.startsWith("/home/")) {
|
||||
return xdgCache.replace(/^\/home\/[^\/]+/, os.homedir())
|
||||
}
|
||||
return xdgCache || path.join(os.homedir(), ".cache")
|
||||
})()
|
||||
const cache = path.join(cacheBase, app)
|
||||
const config = path.join(xdgConfig!, app)
|
||||
const state = path.join(xdgState!, app)
|
||||
|
||||
|
|
@ -28,6 +36,7 @@ await Promise.all([
|
|||
fs.mkdir(Global.Path.state, { recursive: true }),
|
||||
fs.mkdir(Global.Path.log, { recursive: true }),
|
||||
fs.mkdir(Global.Path.bin, { recursive: true }),
|
||||
fs.mkdir(Global.Path.cache, { recursive: true }),
|
||||
])
|
||||
|
||||
const CACHE_VERSION = "14"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue