Skip to content

Commit c9b41c2

Browse files
authored
Merge branch 'dev' into permissions
2 parents 59d2f98 + f968fb9 commit c9b41c2

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

lib/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ const defaultConfig: PluginConfig = {
532532
},
533533
}
534534

535-
const GLOBAL_CONFIG_DIR = join(homedir(), ".config", "opencode")
535+
const GLOBAL_CONFIG_DIR = process.env.XDG_CONFIG_HOME
536+
? join(process.env.XDG_CONFIG_HOME, "opencode")
537+
: join(homedir(), ".config", "opencode")
536538
const GLOBAL_CONFIG_PATH_JSONC = join(GLOBAL_CONFIG_DIR, "dcp.jsonc")
537539
const GLOBAL_CONFIG_PATH_JSON = join(GLOBAL_CONFIG_DIR, "dcp.json")
538540

lib/logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export class Logger {
99

1010
constructor(enabled: boolean) {
1111
this.enabled = enabled
12-
const opencodeConfigDir = join(homedir(), ".config", "opencode")
13-
this.logDir = join(opencodeConfigDir, "logs", "dcp")
12+
const dataHome = process.env.XDG_DATA_HOME || join(homedir(), ".local", "share")
13+
this.logDir = join(dataHome, "opencode", "logs", "dcp")
1414
}
1515

1616
private async ensureLogDir() {

lib/state/persistence.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ export interface PersistedSessionState {
2525
lastUpdated: string
2626
}
2727

28-
const STORAGE_DIR = join(homedir(), ".local", "share", "opencode", "storage", "plugin", "dcp")
28+
const STORAGE_DIR = join(
29+
process.env.XDG_DATA_HOME || join(homedir(), ".local", "share"),
30+
"opencode",
31+
"storage",
32+
"plugin",
33+
"dcp",
34+
)
2935

3036
async function ensureStorageDir(): Promise<void> {
3137
if (!existsSync(STORAGE_DIR)) {

0 commit comments

Comments
 (0)