Skip to content

Commit 519b896

Browse files
Alex4386skotopes
andauthored
Fix invalid path errors while deploying SDK by enforcing toolchain to use UTF-8 on initial SDK Extraction (#4036)
* Fix invalid path errors for non-Latin characters by enforcing UTF-8 (#4024) Due to cryillic alphabet on `/openocd/scripts/target/1986ве1т.cfg`, If the system codepage is handling `WideChar` for cryillic properly, It would cause jumbled characters and fail to decompress via System.IO.Compression.ZipFile without Encoding enforcement. (See #4024 (comment)) * Scripts: fix line endings Co-authored-by: あく <alleteam@gmail.com>
1 parent e11a626 commit 519b896

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scripts/toolchain/windows-toolchain-download.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ $toolchain_dist_temp_path = "$download_dir\$toolchain_dist_folder"
1616
try {
1717

1818
if (Test-Path -LiteralPath "$toolchain_target_path") {
19-
Write-Host -NoNewline "Removing old Windows toolchain.."
20-
Remove-Item -LiteralPath "$toolchain_target_path" -Force -Recurse
21-
Write-Host "done!"
19+
Write-Host -NoNewline "Removing old Windows toolchain.."
20+
Remove-Item -LiteralPath "$toolchain_target_path" -Force -Recurse
21+
Write-Host "done!"
2222
}
2323

2424
if (Test-path -LiteralPath "$toolchain_target_path\..\current") {
25-
Write-Host -NoNewline "Unlinking 'current'.."
25+
Write-Host -NoNewline "Unlinking 'current'.."
2626
Remove-Item -LiteralPath "$toolchain_target_path\..\current" -Force
27-
Write-Host "done!"
27+
Write-Host "done!"
2828
}
2929

3030
if (!(Test-Path -LiteralPath "$toolchain_zip_temp_path" -PathType Leaf)) {
@@ -46,7 +46,8 @@ if (Test-Path -LiteralPath "$toolchain_dist_temp_path") {
4646
Write-Host -NoNewline "Extracting Windows toolchain.."
4747
# This is faster than Expand-Archive
4848
Add-Type -Assembly "System.IO.Compression.Filesystem"
49-
[System.IO.Compression.ZipFile]::ExtractToDirectory("$toolchain_zip_temp_path", "$download_dir")
49+
Add-Type -Assembly "System.Text.Encoding"
50+
[System.IO.Compression.ZipFile]::ExtractToDirectory("$toolchain_zip_temp_path", "$download_dir", [System.Text.Encoding]::UTF8)
5051
# Expand-Archive -LiteralPath "$toolchain_zip_temp_path" -DestinationPath "$download_dir"
5152

5253
Write-Host -NoNewline "moving.."

0 commit comments

Comments
 (0)