fix: correct path construction in install script
- Fix duplicate .openclaw in env file path - Use consistent installDir variable throughout - Fix skills path in OpenClaw config update - Fix fallback path in uninstall function
This commit is contained in:
13
install.mjs
13
install.mjs
@@ -440,16 +440,17 @@ async function configure(env) {
|
|||||||
|
|
||||||
// Create environment config
|
// Create environment config
|
||||||
log(' Creating environment configuration...', 'blue');
|
log(' Creating environment configuration...', 'blue');
|
||||||
|
const installDir = env.openclawDir || join(homedir(), '.openclaw');
|
||||||
const envConfig = [
|
const envConfig = [
|
||||||
'# PaddedCell Environment Configuration',
|
'# PaddedCell Environment Configuration',
|
||||||
`export PATH="${dirname(passMgrPath)}:$PATH"`,
|
`export PATH="${dirname(passMgrPath)}:$PATH"`,
|
||||||
'export PASS_MGR_PATH="pass_mgr"',
|
'export PASS_MGR_PATH="pass_mgr"',
|
||||||
'',
|
'',
|
||||||
'# PaddedCell skills',
|
'# PaddedCell skills',
|
||||||
`export PADDEDCELL_SKILLS_DIR="${join(env.openclawDir || homedir(), '.openclaw', 'skills', 'paddedcell')}"`,
|
`export PADDEDCELL_SKILLS_DIR="${join(installDir, 'skills', 'paddedcell')}"`,
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
const envFile = join(env.openclawDir || homedir(), '.openclaw', 'paddedcell.env');
|
const envFile = join(installDir, 'paddedcell.env');
|
||||||
writeFileSync(envFile, envConfig);
|
writeFileSync(envFile, envConfig);
|
||||||
logSuccess(`Environment config written to ${envFile}`);
|
logSuccess(`Environment config written to ${envFile}`);
|
||||||
|
|
||||||
@@ -458,7 +459,7 @@ async function configure(env) {
|
|||||||
|
|
||||||
// Update OpenClaw plugins.load.paths configuration
|
// Update OpenClaw plugins.load.paths configuration
|
||||||
log('\n Updating OpenClaw plugin configuration...', 'blue');
|
log('\n Updating OpenClaw plugin configuration...', 'blue');
|
||||||
const openclawConfigPath = join(env.openclawDir || homedir(), '.openclaw', 'config.json');
|
const openclawConfigPath = join(installDir, 'config.json');
|
||||||
|
|
||||||
if (existsSync(openclawConfigPath)) {
|
if (existsSync(openclawConfigPath)) {
|
||||||
try {
|
try {
|
||||||
@@ -477,7 +478,7 @@ async function configure(env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add paddedcell skills path if not already present
|
// Add paddedcell skills path if not already present
|
||||||
const skillsPath = join(env.openclawDir || homedir(), '.openclaw', 'skills', 'paddedcell');
|
const skillsPath = join(installDir, 'skills', 'paddedcell');
|
||||||
if (!config.plugins.load.paths.includes(skillsPath)) {
|
if (!config.plugins.load.paths.includes(skillsPath)) {
|
||||||
config.plugins.load.paths.push(skillsPath);
|
config.plugins.load.paths.push(skillsPath);
|
||||||
writeFileSync(openclawConfigPath, JSON.stringify(config, null, 2));
|
writeFileSync(openclawConfigPath, JSON.stringify(config, null, 2));
|
||||||
@@ -491,7 +492,7 @@ async function configure(env) {
|
|||||||
} else {
|
} else {
|
||||||
logWarning(`OpenClaw config not found at ${openclawConfigPath}`);
|
logWarning(`OpenClaw config not found at ${openclawConfigPath}`);
|
||||||
log(' Please manually add the following to your OpenClaw config:', 'yellow');
|
log(' Please manually add the following to your OpenClaw config:', 'yellow');
|
||||||
log(` plugins.load.paths: ["${join(env.openclawDir || homedir(), '.openclaw', 'skills', 'paddedcell')}"]`, 'cyan');
|
log(` plugins.load.paths: ["${join(installDir, 'skills', 'paddedcell')}"]`, 'cyan');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,7 +614,7 @@ function printSummary(env) {
|
|||||||
async function uninstall(env) {
|
async function uninstall(env) {
|
||||||
logStep(1, 'Uninstalling PaddedCell...');
|
logStep(1, 'Uninstalling PaddedCell...');
|
||||||
|
|
||||||
const installDir = options.prefix || env.openclawDir;
|
const installDir = options.prefix || env.openclawDir || join(homedir(), '.openclaw');
|
||||||
const binDir = join(installDir, 'bin');
|
const binDir = join(installDir, 'bin');
|
||||||
const skillsDir = join(installDir, 'skills', 'paddedcell');
|
const skillsDir = join(installDir, 'skills', 'paddedcell');
|
||||||
const envFile = join(installDir, 'paddedcell.env');
|
const envFile = join(installDir, 'paddedcell.env');
|
||||||
|
|||||||
Reference in New Issue
Block a user