feat: add simplified windows x86 support

This commit is contained in:
yankun
2026-06-27 18:33:59 +08:00
parent 7de0777748
commit 67c995db83
12 changed files with 400 additions and 84 deletions
+47
View File
@@ -0,0 +1,47 @@
'use strict';
const os = require('os');
const path = require('path');
const IS_WINDOWS = process.platform === 'win32';
function windowsProgramData() {
return process.env.PROGRAMDATA || 'C:\\ProgramData';
}
function getConfigDir() {
if (process.env.CLAWD_CONFIG_DIR) return process.env.CLAWD_CONFIG_DIR;
if (IS_WINDOWS) return path.join(windowsProgramData(), 'OpenClaw', 'clawd');
return process.getuid && process.getuid() === 0
? '/etc/clawd'
: path.join(os.homedir(), '.clawd');
}
function getPersistentFile(name) {
return path.join(getConfigDir(), name);
}
function getOpenClawConfigCandidates() {
if (IS_WINDOWS) {
const candidates = [
path.join(os.homedir(), '.openclaw', 'openclaw.json'),
path.join(windowsProgramData(), 'OpenClaw', 'openclaw.json'),
path.join(windowsProgramData(), 'OpenClaw', 'config', 'openclaw.json'),
];
if (process.env.OPENCLAW_CONFIG) candidates.unshift(process.env.OPENCLAW_CONFIG);
return candidates;
}
return [
path.join(os.homedir(), '.openclaw', 'openclaw.json'),
'/home/sts/.openclaw/openclaw.json',
'/root/.openclaw/openclaw.json',
];
}
module.exports = {
IS_WINDOWS,
getConfigDir,
getPersistentFile,
getOpenClawConfigCandidates,
};