From 6f80dd1fccc10acba556b87b7c0d3897a0ee031c Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 11 Jun 2021 14:36:52 +0200 Subject: [PATCH] Registry api win7 compat --- bootstrap-haskell.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-haskell.ps1 b/bootstrap-haskell.ps1 index ea15f3e..705f33f 100644 --- a/bootstrap-haskell.ps1 +++ b/bootstrap-haskell.ps1 @@ -67,7 +67,7 @@ function Add-EnvPath { $hiveKey = $envKey = $null try { - $hiveKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($hive, 'Default') + $hiveKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($hive, '') $envKey = $hiveKey.OpenSubKey($keyPath, $true) $rawPath = $envKey.GetValue('PATH', '', 'DoNotExpandEnvironmentNames') @@ -78,8 +78,8 @@ function Add-EnvPath { } } finally { - if ($envKey) { $envKey.Dispose() } - if ($hiveKey) { $hiveKey.Dispose() } + if ($envKey) { $envKey.Close() } + if ($hiveKey) { $hiveKey.Close() } } } }