Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ const defaultConfig: PluginConfig = {
},
}

const GLOBAL_CONFIG_DIR = join(homedir(), ".config", "opencode")
const GLOBAL_CONFIG_DIR = process.env.XDG_CONFIG_HOME
? join(process.env.XDG_CONFIG_HOME, "opencode")
: join(homedir(), ".config", "opencode")
const GLOBAL_CONFIG_PATH_JSONC = join(GLOBAL_CONFIG_DIR, "dcp.jsonc")
const GLOBAL_CONFIG_PATH_JSON = join(GLOBAL_CONFIG_DIR, "dcp.json")

Expand Down
5 changes: 3 additions & 2 deletions lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export class Logger {

constructor(enabled: boolean) {
this.enabled = enabled
const opencodeConfigDir = join(homedir(), ".config", "opencode")
this.logDir = join(opencodeConfigDir, "logs", "dcp")
const dataHome =
process.env.XDG_DATA_HOME || join(homedir(), ".local", "share")
this.logDir = join(dataHome, "opencode", "logs", "dcp")
}

private async ensureLogDir() {
Expand Down
8 changes: 7 additions & 1 deletion lib/state/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ export interface PersistedSessionState {
lastUpdated: string
}

const STORAGE_DIR = join(homedir(), ".local", "share", "opencode", "storage", "plugin", "dcp")
const STORAGE_DIR = join(
process.env.XDG_DATA_HOME || join(homedir(), ".local", "share"),
"opencode",
"storage",
"plugin",
"dcp",
)

async function ensureStorageDir(): Promise<void> {
if (!existsSync(STORAGE_DIR)) {
Expand Down
Loading