Move the Global module from packages/opencode/src/global to packages/core/src/global to provide a unified location for managing XDG directories and application paths. This eliminates duplicate path definitions across packages and ensures consistent access to data, config, cache, state, log, and bin directories throughout the codebase.
16 lines
510 B
TypeScript
16 lines
510 B
TypeScript
import { createMemo } from "solid-js"
|
|
import { useProject } from "./project"
|
|
import { useSync } from "./sync"
|
|
import { Global } from "@opencode-ai/core/global"
|
|
|
|
export function useDirectory() {
|
|
const project = useProject()
|
|
const sync = useSync()
|
|
return createMemo(() => {
|
|
const directory = project.instance.path().directory || process.cwd()
|
|
const result = directory.replace(Global.Path.home, "~")
|
|
if (sync.data.vcs?.branch) return result + ":" + sync.data.vcs.branch
|
|
return result
|
|
})
|
|
}
|