You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Handle the zip file extraction - in a way that allows to handle
No initial folder
Folder - but empty
Folder - with files, being wiped - prior moving forward
If the folder exists - user will be asked to use force, regardless of the folder containing files or not
#lets work with the extracted directory from now on
232
-
$Path=$extractedPath
228
+
229
+
if (-not$Force) {
230
+
if (-not (Test-PathExists-Path $extractedPath-Type Container -ShouldNotExist)) {
231
+
Write-PSFMessage-Level Host -Message "The directory at the <c='em'>$extractedPath</c> location already exists. If you want to override it - set the <c='em'>Force</c> parameter to clear the folder and extract the content into it."
232
+
Stop-PSFFunction-Message "Stopping because output path was already present."
if ((Get-Process-Name "devenv"-ErrorAction SilentlyContinue).Count -gt0) {
47
-
Write-PSFMessage-Level Host -Message "It seems that you have a <c='em'>Visual Studio</c> running. Please ensure <c='em'>exit</c> Visual Studio and run the cmdlet again."
48
-
Stop-PSFFunction-Message "Stopping because of running Visual Studio."
49
-
return
50
-
}
48
+
if ((Get-Process-Name "devenv"-ErrorAction SilentlyContinue).Count -gt0) {
49
+
Write-PSFMessage-Level Host -Message "It seems that you have a <c='em'>Visual Studio</c> running. Please ensure <c='em'>exit</c> Visual Studio and run the cmdlet again."
50
+
Stop-PSFFunction-Message "Stopping because of running Visual Studio."
51
+
return
52
+
}
51
53
52
-
Invoke-TimeSignal-Start
54
+
Invoke-TimeSignal-Start
53
55
54
56
55
-
#Test if input is a zipFile that needs to be extracted first
#Test if input is a zipFile that needs to be extracted first
58
+
if ($Path.EndsWith(".zip")) {
59
+
Unblock-File-Path $Path
60
+
61
+
$extractedPath=$path.Remove($path.Length-4)
62
+
63
+
if (-not$Force) {
64
+
if (-not (Test-PathExists-Path $extractedPath-Type Container -ShouldNotExist)) {
65
+
Write-PSFMessage-Level Host -Message "The directory at the <c='em'>$extractedPath</c> location already exists. If you want to override it - set the <c='em'>Force</c> parameter to clear the folder and extract the content into it."
66
+
Stop-PSFFunction-Message "Stopping because output path was already present."
Write-PSFMessage-Level Host -Message "No /AOSService/Packages/files folder found in the package. Please ensure that the package is extracted correctly."
86
-
Stop-PSFFunction-Message "Stopping because of missing files folder."
Write-PSFMessage-Level Host -Message "No /AOSService/Packages/files folder found in the package. Please ensure that the package is extracted correctly."
99
+
Stop-PSFFunction-Message "Stopping because of missing files folder."
0 commit comments