音乐模块调整
This commit is contained in:
+11
-10
@@ -54,17 +54,18 @@ $tauriConf = Join-Path $Root 'src-tauri\tauri.conf.json'
|
||||
$cargoToml = Join-Path $Root 'src-tauri\Cargo.toml'
|
||||
$pkgJson = Join-Path $Root 'package.json'
|
||||
|
||||
$t = Get-Content $tauriConf -Raw
|
||||
$t = $t -replace '("version"\s*:\s*")[^"]*(")', "`${1}$Version`${2}"
|
||||
[System.IO.File]::WriteAllText($tauriConf, $t, (New-Object System.Text.UTF8Encoding($false)))
|
||||
# UTF-8 安全读写:`Get-Content` 默认按系统 ANSI(如 GBK) 解码,会把本就含中文/乱码的文件二次编码损坏(曾导致
|
||||
# Cargo.toml 的 keyring 依赖行被弄丢)。这里统一用显式 UTF-8 无 BOM 读写,保证逐字节稳定往返。
|
||||
function Set-Utf8Version([string]$Path, [string]$Pattern, [string]$NewVersion) {
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
$content = [System.IO.File]::ReadAllText($Path, $utf8NoBom)
|
||||
$content = $content -replace $Pattern, "`${1}$NewVersion`${2}"
|
||||
[System.IO.File]::WriteAllText($Path, $content, $utf8NoBom)
|
||||
}
|
||||
|
||||
$c = Get-Content $cargoToml -Raw
|
||||
$c = $c -replace '(?m)^(version\s*=\s*")[^"]*(")', "`${1}$Version`${2}"
|
||||
[System.IO.File]::WriteAllText($cargoToml, $c, (New-Object System.Text.UTF8Encoding($false)))
|
||||
|
||||
$p = Get-Content $pkgJson -Raw
|
||||
$p = $p -replace '("version"\s*:\s*")[^"]*(")', "`${1}$Version`${2}"
|
||||
[System.IO.File]::WriteAllText($pkgJson, $p, (New-Object System.Text.UTF8Encoding($false)))
|
||||
Set-Utf8Version -Path $tauriConf -Pattern '("version"\s*:\s*")[^"]*(")' -NewVersion $Version
|
||||
Set-Utf8Version -Path $cargoToml -Pattern '(?m)^(version\s*=\s*")[^"]*(")' -NewVersion $Version
|
||||
Set-Utf8Version -Path $pkgJson -Pattern '("version"\s*:\s*")[^"]*(")' -NewVersion $Version
|
||||
Write-Step "版本号已同步:tauri.conf.json / Cargo.toml / package.json"
|
||||
|
||||
# ---------- 2. 构建 ----------
|
||||
|
||||
Reference in New Issue
Block a user