Sha256: ac9dbf5fd1fc9b4559ec7bc0b166ce24d341e295c88ca1319327cf31ea264ec7

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

$path = $ExecutionContext.SessionState.Path
$tempFile = $path.GetUnresolvedProviderPathFromPSPath("<%= src %>")
$dest = $path.GetUnresolvedProviderPathFromPSPath("<%= dest %>")

function Decode-File($encodedFile, $decodedFile) {
    if (Test-Path $encodedFile) {
      $base64Content = Get-Content $encodedFile
    }
    if ($base64Content -eq $null) {
        New-Item -ItemType file -Force $decodedFile | Out-Null
    }
    else {
        $bytes = [System.Convert]::FromBase64String($base64Content)
        [System.IO.File]::WriteAllBytes($decodedFile, $bytes) | Out-Null
    }
}

function Ensure-Dir-Exists($path) {
    # ensure the destination directory exists
    if (!(Test-Path $path)) {
        New-Item -ItemType Directory -Force -Path $path | Out-Null
    }
}

if ([System.IO.Path]::GetExtension($tempFile) -eq '.zip') {
    Ensure-Dir-Exists $dest
    Decode-File $tempFile $tempFile
    $shellApplication = New-Object -com shell.application
    $zipPackage = $shellApplication.NameSpace($tempFile)
    $destinationFolder = $shellApplication.NameSpace($dest)
    $destinationFolder.CopyHere($zipPackage.Items(), 0x10) | Out-Null
}
else {
    Ensure-Dir-Exists ([System.IO.Path]::GetDirectoryName($dest))
    Decode-File $tempFile $dest
}

Version data entries

9 entries across 8 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/winrm-fs-0.2.3/lib/winrm-fs/scripts/decode_file.ps1.erb
winrm-fs-0.2.3 lib/winrm-fs/scripts/decode_file.ps1.erb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/winrm-fs-0.2.2/lib/winrm-fs/scripts/decode_file.ps1.erb
winrm-fs-0.2.2 lib/winrm-fs/scripts/decode_file.ps1.erb
winrm-fs-0.2.1 lib/winrm-fs/scripts/decode_file.ps1.erb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/winrm-fs-0.1.0/lib/winrm-fs/scripts/decode_file.ps1.erb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/winrm-fs-0.2.0/lib/winrm-fs/scripts/decode_file.ps1.erb
winrm-fs-0.2.0 lib/winrm-fs/scripts/decode_file.ps1.erb
winrm-fs-0.1.0 lib/winrm-fs/scripts/decode_file.ps1.erb