From 02ed45fa617b791e26b65178a1ad4597f66b08d7 Mon Sep 17 00:00:00 2001 From: Dimitrij Date: Wed, 15 Dec 2021 01:31:26 +0000 Subject: [PATCH] added file exist check and null check --- Tools/zip_files.ps1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Tools/zip_files.ps1 b/Tools/zip_files.ps1 index fde2225c2..b8a991f14 100644 --- a/Tools/zip_files.ps1 +++ b/Tools/zip_files.ps1 @@ -12,6 +12,7 @@ $ConfigurationName ) +Write-Output "" Write-Output "===== Beginning $($PSCmdlet.MyInvocation.MyCommand) =====" $ConfigurationName = $ConfigurationName.Trim() @@ -46,8 +47,13 @@ if ($ConfigurationName -match "Release") { } # Local build else { - $outputZipPath = "$($SolutionDir)Release\$zipFilePrefix-$($version).zip" - Compress-Archive $debugFile $outputZipPath -Force + if (!(Test-Path -Path $debugFile -PathType Leaf)) + { + $outputZipPath = "$($SolutionDir)Release\$zipFilePrefix-$($version).zip" + Compress-Archive $debugFile $outputZipPath -Force + } else { + write-host "File do not exist:" $debugFile", nothing to compress" + } } Remove-Item $debugFile @@ -64,8 +70,13 @@ if ($ConfigurationName -eq "Release Portable") { } # Local build else { - $outputZipPath="$($SolutionDir)\Release\mRemoteNG-Portable-$($version).zip" - Compress-Archive $Source $outputZipPath -Force + if ($Source) + { + $outputZipPath="$($SolutionDir)\Release\mRemoteNG-Portable-$($version).zip" + Compress-Archive $Source $outputZipPath -Force + } else { + write-host "File do not exist:" $Source", nothing to compress" + } } }