File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,17 +23,24 @@ jobs:
2323 run : |
2424 dotnet build OTAPIXmlDocument.sln -c Release
2525 ota_content=$(cat OTAPI/OTAPI.xml)
26- ota_path=".nuget/packages/otapi.upcoming/3.1.20/lib/net6.0"
2726 powershell_script=$(cat <<EOL
2827 \$OTA = @"
2928 $ota_content
3029 "@
31- if (Test-Path -Path "\$env:USERPROFILE/$ota_path/ OTAPI.dll") {
32- New-Item -Path "\$env:USERPROFILE/$ota_path" -Name "OTAPI.xml" -ItemType "file" -Force
33- Set-Content -Path "\$env:USERPROFILE/$ota_path/OTAPI.xml" -Value \$OTA
34- Write-Host "OTAPI.xml 文件已安装到: \$env:USERPROFILE/.nuget/packages/otapi.upcoming/3.1.20/lib/net6.0/ OTAPI.xml 。"
30+ \$dllFiles = Get-ChildItem -Path "\$env:USERPROFILE/.nuget/packages/otapi.upcoming" -Recurse -Filter " OTAPI.dll"
31+
32+ if (\$dllFiles.Count -eq 0) {
33+ Write-Host "未找到任何 OTAPI.dll 文件 。"
3534 } else {
36- Write-Host "OTAPI.dll 文件不存在。"
35+ foreach (\$dllFile in \$dllFiles) {
36+ \$targetDir = \$dllFile.DirectoryName
37+ \$xmlPath = Join-Path -Path \$targetDir -ChildPath "OTAPI.xml"
38+
39+ New-Item -Path \$xmlPath -ItemType "file" -Force | Out-Null
40+ Set-Content -Path \$xmlPath -Value \$OTA
41+
42+ Write-Host "已创建 OTAPI.xml 在: \$xmlPath"
43+ }
3744 }
3845 Pause
3946 EOL
You can’t perform that action at this time.
0 commit comments