修复脚本编码

This commit is contained in:
小朱
2025-07-19 17:34:05 +08:00
parent 630b87a196
commit 2ecb5a9ef3
2 changed files with 6 additions and 7 deletions

View File

@@ -30,7 +30,8 @@
"archiver": "^6.0.1",
"fs-extra": "^11.2.0",
"@types/fs-extra": "^11.0.4",
"@types/archiver": "^6.0.2"
"@types/archiver": "^6.0.2",
"iconv-lite": "^0.6.3"
},
"keywords": [
"game",

View File

@@ -5,6 +5,7 @@ const { execSync } = require('child_process')
const https = require('https')
const { pipeline } = require('stream')
const { promisify } = require('util')
const iconv = require('iconv-lite')
const pipelineAsync = promisify(pipeline)
const packageName = 'gsm3-management-panel'
@@ -195,8 +196,7 @@ pause`
await fs.writeFile(
path.join(packageDir, 'start.bat'),
startScript,
'latin1' // 使用ANSI编码
iconv.encode(startScript, 'gbk') // 使用iconv-lite转换为GBK编码
)
} else if (buildTarget === 'linux') {
const startShScript = `#!/bin/bash
@@ -225,8 +225,7 @@ pause`
await fs.writeFile(
path.join(packageDir, 'start.bat'),
startScript,
'latin1' // 使用ANSI编码
iconv.encode(startScript, 'gbk') // 使用iconv-lite转换为GBK编码
)
const startShScript = `#!/bin/bash
@@ -258,8 +257,7 @@ pause`
await fs.writeFile(
path.join(packageDir, 'install-python-deps.bat'),
installPythonDepsScript,
'latin1' // 使用ANSI编码
iconv.encode(installPythonDepsScript, 'gbk') // 使用iconv-lite转换为GBK编码
)
// 创建Linux Python依赖安装脚本