File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Microsoft.PowerShell.Archive Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ function Compress-Archive
79
79
)
80
80
81
81
BEGIN
82
- {
82
+ {
83
+ # Ensure the destination path is in a non-PS-specific format
84
+ $DestinationPath = $PSCmdlet.GetUnresolvedProviderPathFromPSPath ($DestinationPath )
85
+
83
86
$inputPaths = @ ()
84
87
$destinationParentDir = [system.IO.Path ]::GetDirectoryName($DestinationPath )
85
88
if ($null -eq $destinationParentDir )
Original file line number Diff line number Diff line change @@ -685,6 +685,19 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
685
685
try { Expand-Archive - Path $sourcePath - DestinationPath $destinationPath ; throw " Expand-Archive did NOT throw expected error" }
686
686
catch { $_.FullyQualifiedErrorId | Should Be " InvalidDirectoryPath,Expand-Archive" }
687
687
}
688
+
689
+ It " Validate that you can compress an archive to a custom PSDrive using the Compress-Archive cmdlet" {
690
+ $sourcePath = " $TestDrive \SourceDir\ChildDir-1\Sample-3.txt"
691
+ $destinationDriveName = ' CompressArchivePesterTest'
692
+ $destinationDrive = New-PSDrive - Name $destinationDriveName - PSProvider FileSystem - Root $TestDrive - Scope Global
693
+ $destinationPath = " ${destinationDriveName} :\CompressToPSDrive.zip"
694
+ try {
695
+ Compress-Archive - Path $sourcePath - DestinationPath $destinationPath
696
+ $destinationPath | Should Exist
697
+ } finally {
698
+ Remove-PSDrive - LiteralName $destinationDriveName
699
+ }
700
+ }
688
701
}
689
702
690
703
Context " Expand-Archive - functional test cases" {
You can’t perform that action at this time.
0 commit comments