update
This commit is contained in:
@@ -283,11 +283,28 @@ if (Test-Path $zipPath) {
|
||||
Remove-Item $zipPath -Force
|
||||
}
|
||||
|
||||
# Pakuj zawartosc temp dir (bez folderu temp/)
|
||||
$originalLocation = Get-Location
|
||||
Set-Location $tempDir
|
||||
Compress-Archive -Path '*' -DestinationPath "../../$zipPath" -Force
|
||||
Set-Location $originalLocation
|
||||
# Pakuj z forward-slashami (Compress-Archive uzywa backslashy na Windowsie)
|
||||
Add-Type -AssemblyName System.IO.Compression
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
$absZipPath = (Resolve-Path $updatesDir).Path + "\ver_$versionNumber.zip"
|
||||
$absTempDir = (Resolve-Path $tempDir).Path
|
||||
|
||||
$zipStream = [System.IO.File]::Create($absZipPath)
|
||||
$zip = New-Object System.IO.Compression.ZipArchive($zipStream, [System.IO.Compression.ZipArchiveMode]::Create)
|
||||
|
||||
Get-ChildItem $absTempDir -Recurse -File | ForEach-Object {
|
||||
$entryName = $_.FullName.Substring($absTempDir.Length + 1) -replace '\\', '/'
|
||||
$entry = $zip.CreateEntry($entryName)
|
||||
$entryStream = $entry.Open()
|
||||
$fileStream = [System.IO.File]::OpenRead($_.FullName)
|
||||
$fileStream.CopyTo($entryStream)
|
||||
$fileStream.Close()
|
||||
$entryStream.Close()
|
||||
}
|
||||
|
||||
$zip.Dispose()
|
||||
$zipStream.Close()
|
||||
|
||||
Write-Ok "Utworzono ZIP: $zipPath"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user