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 @@ -83,7 +83,10 @@ function Compress-Archive
83
83
)
84
84
85
85
BEGIN
86
- {
86
+ {
87
+ # Ensure the destination path is in a non-PS-specific format
88
+ $DestinationPath = $PSCmdlet.GetUnresolvedProviderPathFromPSPath ($DestinationPath )
89
+
87
90
$inputPaths = @ ()
88
91
$destinationParentDir = [system.IO.Path ]::GetDirectoryName($DestinationPath )
89
92
if ($null -eq $destinationParentDir )
Original file line number Diff line number Diff line change @@ -706,6 +706,19 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
706
706
try { Expand-Archive - Path $sourcePath - DestinationPath $destinationPath ; throw " Expand-Archive did NOT throw expected error" }
707
707
catch { $_.FullyQualifiedErrorId | Should Be " InvalidDirectoryPath,Expand-Archive" }
708
708
}
709
+
710
+ It " Validate that you can compress an archive to a custom PSDrive using the Compress-Archive cmdlet" {
711
+ $sourcePath = " $TestDrive \SourceDir\ChildDir-1\Sample-3.txt"
712
+ $destinationDriveName = ' CompressArchivePesterTest'
713
+ $destinationDrive = New-PSDrive - Name $destinationDriveName - PSProvider FileSystem - Root $TestDrive - Scope Global
714
+ $destinationPath = " ${destinationDriveName} :\CompressToPSDrive.zip"
715
+ try {
716
+ Compress-Archive - Path $sourcePath - DestinationPath $destinationPath
717
+ $destinationPath | Should Exist
718
+ } finally {
719
+ Remove-PSDrive - LiteralName $destinationDriveName
720
+ }
721
+ }
709
722
}
710
723
711
724
Context " Expand-Archive - functional test cases" {
You can’t perform that action at this time.
0 commit comments