Skip to content

Commit

Permalink
Fixed Expand-Archive issues on some Powershell installations.
Browse files Browse the repository at this point in the history
  • Loading branch information
trparky committed Feb 15, 2024
1 parent 3ddeb82 commit f5b9122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Export-Bitwarden.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Export-Bitwarden.psm1'

# Version number of this module.
ModuleVersion = '1.38'
ModuleVersion = '1.39'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
13 changes: 7 additions & 6 deletions Export-Bitwarden.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Export-Bitwarden { # Don't touch this line!
# == WARNING!!! DO NOT TOUCH ANYTHING BELOW THIS!!! ==
# ====================================================

$ver = "1.38"
$ver = "1.39"

Write-Host -ForegroundColor Green "========================================================================================"
Write-Host -ForegroundColor Green "== Bitwarden Vault Export Script v$ver =="
Expand Down Expand Up @@ -66,18 +66,19 @@ function Export-Bitwarden { # Don't touch this line!
elseif ($IsLinux) { Invoke-WebRequest -Uri "https://vault.bitwarden.com/download/?app=cli&platform=linux" -OutFile $zipFilePath }
elseif ($IsMacOS) { Invoke-WebRequest -Uri "https://vault.bitwarden.com/download/?app=cli&platform=macos" -OutFile $zipFilePath }

if ($IsWindows) { Microsoft.PowerShell.Archive\Expand-Archive -Path $zipFilePath -OutputPath $PSScriptRoot }
else {
Set-Location -Path $PSScriptRoot
Expand-Archive -Path $zipFilePath
}
Set-Location -Path $PSScriptRoot
Expand-Archive -Path $zipFilePath

if ($IsLinux || $IsMacOS) {
Move-Item -Path (Join-Path $PSScriptRoot "bw" "bw") -Destination (Join-Path $PSScriptRoot "bw.tmp")
Remove-Item -Force (Join-Path $PSScriptRoot "bw")
Move-Item -Path (Join-Path $PSScriptRoot "bw.tmp") -Destination (Join-Path $PSScriptRoot "bw")
chmod 755 (Join-Path $PSScriptRoot "bw")
}
elseif ($IsWindows) {
Move-Item -Path (Join-Path $PSScriptRoot "bw" "bw.exe") -Destination (Join-Path $PSScriptRoot "bw.exe")
Remove-Item -Force (Join-Path $PSScriptRoot "bw")
}

Remove-Item -Path $zipFilePath

Expand Down

1 comment on commit f5b9122

@trparky
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue doesn't appear to be a problem on my desktop's PowerShell installation, but it does appear on my notebook's PowerShell installation. Why? I have no idea.

Please sign in to comment.