mirror of
https://github.com/affaan-m/ECC.git
synced 2026-08-28 18:59:47 +02:00
fix(release): clear final review blockers
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
function configuredDirectory(environment, name) {
|
||||
const value = environment && environment[name];
|
||||
return typeof value === 'string' && value.trim() !== ''
|
||||
? path.resolve(value.trim())
|
||||
: null;
|
||||
}
|
||||
|
||||
function resolveOpencodeConfigRoot(options = {}) {
|
||||
const environment = options.env || process.env;
|
||||
const explicitRoot = configuredDirectory(environment, 'OPENCODE_CONFIG_DIR');
|
||||
if (explicitRoot) {
|
||||
return explicitRoot;
|
||||
}
|
||||
|
||||
const xdgConfigRoot = configuredDirectory(environment, 'XDG_CONFIG_HOME');
|
||||
if (xdgConfigRoot) {
|
||||
return path.join(xdgConfigRoot, 'opencode');
|
||||
}
|
||||
|
||||
return path.join(path.resolve(options.homeDir || os.homedir()), '.config', 'opencode');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
resolveOpencodeConfigRoot,
|
||||
};
|
||||
Reference in New Issue
Block a user