fix(update): automatically ensure hose-aipro symlink exists upon binary update
This commit is contained in:
1 parent
c18ff02386
commit
3573ef71aa
1 file changed
+21
-1
@@ -1,4 +1,4 @@
|
|||||||
import { chmodSync, existsSync, mkdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
import { chmodSync, existsSync, mkdirSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import { spawnSync } from "node:child_process";
|
import { spawnSync } from "node:child_process";
|
||||||
import { isCompiledBinary, resolveAppRoot } from "../../core/runtime.js";
|
import { isCompiledBinary, resolveAppRoot } from "../../core/runtime.js";
|
||||||
@@ -458,8 +458,28 @@ export async function handleUpdateCommand(
|
|||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
renameSync(newBinaryPath, execPath);
|
renameSync(newBinaryPath, execPath);
|
||||||
|
|
||||||
|
// Ensure Windows hose-aipro.cmd wrapper exists
|
||||||
|
const cmdWrapper = join(execDir, "hose-aipro.cmd");
|
||||||
|
if (!existsSync(cmdWrapper)) {
|
||||||
|
try {
|
||||||
|
writeFileSync(cmdWrapper, '@echo off\r\n"%~dp0hose-use.exe" %*\r\n', "utf8");
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
renameSync(newBinaryPath, execPath);
|
renameSync(newBinaryPath, execPath);
|
||||||
|
|
||||||
|
// Ensure Unix hose-aipro symlink exists and points to the main binary
|
||||||
|
const aiproLink = join(execDir, "hose-aipro");
|
||||||
|
if (!existsSync(aiproLink)) {
|
||||||
|
try {
|
||||||
|
symlinkSync(execPath, aiproLink);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const skillSync = syncGlobalSkillIfPresent();
|
const skillSync = syncGlobalSkillIfPresent();
|
||||||
|
|||||||
Reference in new issue
Block a user