mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-22 17:00:14 +08:00
fix(code-tools): support Chinese paths and validate directory existence (#11489)
- Add `chcp 65001` to Windows batch file to switch CMD.exe to UTF-8 code page, fixing CLI tool launch failure when working directory contains Chinese or other non-ASCII characters - Add directory existence validation before launching terminal to provide immediate error feedback instead of delayed failure Closes #11483 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a2f67dddb6
commit
d15571c727
@ -548,6 +548,17 @@ class CodeToolsService {
|
|||||||
logger.debug(`Environment variables:`, Object.keys(env))
|
logger.debug(`Environment variables:`, Object.keys(env))
|
||||||
logger.debug(`Options:`, options)
|
logger.debug(`Options:`, options)
|
||||||
|
|
||||||
|
// Validate directory exists before proceeding
|
||||||
|
if (!directory || !fs.existsSync(directory)) {
|
||||||
|
const errorMessage = `Directory does not exist: ${directory}`
|
||||||
|
logger.error(errorMessage)
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: errorMessage,
|
||||||
|
command: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const packageName = await this.getPackageName(cliTool)
|
const packageName = await this.getPackageName(cliTool)
|
||||||
const bunPath = await this.getBunPath()
|
const bunPath = await this.getBunPath()
|
||||||
const executableName = await this.getCliExecutableName(cliTool)
|
const executableName = await this.getCliExecutableName(cliTool)
|
||||||
@ -709,6 +720,7 @@ class CodeToolsService {
|
|||||||
// Build bat file content, including debug information
|
// Build bat file content, including debug information
|
||||||
const batContent = [
|
const batContent = [
|
||||||
'@echo off',
|
'@echo off',
|
||||||
|
'chcp 65001 >nul 2>&1', // Switch to UTF-8 code page for international path support
|
||||||
`title ${cliTool} - Cherry Studio`, // Set window title in bat file
|
`title ${cliTool} - Cherry Studio`, // Set window title in bat file
|
||||||
'echo ================================================',
|
'echo ================================================',
|
||||||
'echo Cherry Studio CLI Tool Launcher',
|
'echo Cherry Studio CLI Tool Launcher',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user