yingclaw 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/desktop.js +10 -5
- package/package.json +1 -1
package/lib/desktop.js
CHANGED
|
@@ -231,7 +231,7 @@ function isDesktopConfigured(options = {}) {
|
|
|
231
231
|
return meta.entries.some((entry) => entry && entry.name === YINGCLAW_ENTRY_NAME);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
function buildClaudeDesktopOpenCommands(platform = process.platform) {
|
|
234
|
+
function buildClaudeDesktopOpenCommands(platform = process.platform, options = {}) {
|
|
235
235
|
// 必须先完全退出 Claude,新配置只在启动时读取一次
|
|
236
236
|
if (platform === 'darwin') {
|
|
237
237
|
return [
|
|
@@ -244,10 +244,15 @@ function buildClaudeDesktopOpenCommands(platform = process.platform) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
if (platform === 'win32') {
|
|
247
|
-
//
|
|
247
|
+
// 在 Node 里展开 LOCALAPPDATA,避免 cmd /c 解析带空格的中文路径出错
|
|
248
|
+
const localAppData = options.localAppData
|
|
249
|
+
|| process.env.LOCALAPPDATA
|
|
250
|
+
|| `${options.homeDir || os.homedir()}\\AppData\\Local`;
|
|
251
|
+
const claudeDir = `${localAppData}\\AnthropicClaude`;
|
|
252
|
+
// taskkill /T 连带杀子进程;start "" /D 切到 Claude 目录后启动 Claude.exe(Squirrel 标准安装位置)
|
|
248
253
|
return [
|
|
249
|
-
{ command: 'taskkill', args: ['/IM', 'Claude.exe', '/F', '/T'], optional: true, waitAfter:
|
|
250
|
-
{ command: 'cmd', args: ['/c', 'start', '
|
|
254
|
+
{ command: 'taskkill', args: ['/IM', 'Claude.exe', '/F', '/T'], optional: true, waitAfter: 1500 },
|
|
255
|
+
{ command: 'cmd', args: ['/c', 'start', '', '/D', claudeDir, 'Claude.exe'], optional: true, waitAfter: 800 },
|
|
251
256
|
];
|
|
252
257
|
}
|
|
253
258
|
|
|
@@ -260,7 +265,7 @@ async function sleep(ms) {
|
|
|
260
265
|
|
|
261
266
|
async function openClaudeDesktop(options = {}) {
|
|
262
267
|
const platform = options.platform || process.platform;
|
|
263
|
-
const commands = buildClaudeDesktopOpenCommands(platform);
|
|
268
|
+
const commands = buildClaudeDesktopOpenCommands(platform, options);
|
|
264
269
|
if (!commands) return { result: 'unsupported' };
|
|
265
270
|
|
|
266
271
|
const runner = options.runner || spawnSync;
|