mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-10-01 17:56:44 +00:00
Use -Path instead of -InputStream parameter for Get-FileHash (closes #1905)
Fixes a problem with Get-FileHash not excepting -InputStream parameter in PowerShell 4.0
This commit is contained in:
+2
-2
@@ -452,10 +452,10 @@ function check_hash($file, $url, $manifest, $arch) {
|
||||
|
||||
function compute_hash($file, $algname) {
|
||||
try {
|
||||
$fs = [system.io.file]::openread($file)
|
||||
if([bool](Get-Command -Name Get-FileHash -ErrorAction SilentlyContinue) -eq $true) {
|
||||
return (Get-FileHash -InputStream $fs -Algorithm $algname).Hash.ToLower()
|
||||
return (Get-FileHash -Path $file -Algorithm $algname).Hash.ToLower()
|
||||
} else {
|
||||
$fs = [system.io.file]::openread($file)
|
||||
$alg = [system.security.cryptography.hashalgorithm]::create($algname)
|
||||
$hexbytes = $alg.computehash($fs) | % { $_.tostring('x2') }
|
||||
return [string]::join('', $hexbytes)
|
||||
|
||||
Reference in New Issue
Block a user