|
@@ -11,6 +11,7 @@ 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)
|
|
const state = path.join(xdgState!, app)
|
|
|
|
|
+const tmp = path.join(os.tmpdir(), app)
|
|
|
|
|
|
|
|
const paths = {
|
|
const paths = {
|
|
|
get home() {
|
|
get home() {
|
|
@@ -22,6 +23,7 @@ const paths = {
|
|
|
cache,
|
|
cache,
|
|
|
config,
|
|
config,
|
|
|
state,
|
|
state,
|
|
|
|
|
+ tmp,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const Path = paths
|
|
export const Path = paths
|
|
@@ -32,6 +34,7 @@ await Promise.all([
|
|
|
fs.mkdir(Path.data, { recursive: true }),
|
|
fs.mkdir(Path.data, { recursive: true }),
|
|
|
fs.mkdir(Path.config, { recursive: true }),
|
|
fs.mkdir(Path.config, { recursive: true }),
|
|
|
fs.mkdir(Path.state, { recursive: true }),
|
|
fs.mkdir(Path.state, { recursive: true }),
|
|
|
|
|
+ fs.mkdir(Path.tmp, { recursive: true }),
|
|
|
fs.mkdir(Path.log, { recursive: true }),
|
|
fs.mkdir(Path.log, { recursive: true }),
|
|
|
fs.mkdir(Path.bin, { recursive: true }),
|
|
fs.mkdir(Path.bin, { recursive: true }),
|
|
|
])
|
|
])
|
|
@@ -44,6 +47,7 @@ export interface Interface {
|
|
|
readonly cache: string
|
|
readonly cache: string
|
|
|
readonly config: string
|
|
readonly config: string
|
|
|
readonly state: string
|
|
readonly state: string
|
|
|
|
|
+ readonly tmp: string
|
|
|
readonly bin: string
|
|
readonly bin: string
|
|
|
readonly log: string
|
|
readonly log: string
|
|
|
}
|
|
}
|
|
@@ -55,6 +59,7 @@ export function make(input: Partial<Interface> = {}): Interface {
|
|
|
cache: Path.cache,
|
|
cache: Path.cache,
|
|
|
config: Flag.OPENCODE_CONFIG_DIR ?? Path.config,
|
|
config: Flag.OPENCODE_CONFIG_DIR ?? Path.config,
|
|
|
state: Path.state,
|
|
state: Path.state,
|
|
|
|
|
+ tmp: Path.tmp,
|
|
|
bin: Path.bin,
|
|
bin: Path.bin,
|
|
|
log: Path.log,
|
|
log: Path.log,
|
|
|
...input,
|
|
...input,
|