File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 if (-not $script :Supported ) { throw ' Sodium is not supported on this platform.' }
2020 if ($script :SodiumInitialized ) { return }
2121
22- $initializationResult = [PSModule.Sodium ]::sodium_init()
22+ try {
23+ $initializationResult = [PSModule.Sodium ]::sodium_init()
24+ } catch {
25+ if ($IsWindows ) {
26+ $script :Supported = Assert-VisualCRedistributableInstalled - Version ' 14.0' - Architecture $script :ProcessArchitecture
27+ }
28+ throw
29+ }
2330 if ($initializationResult -lt 0 ) {
2431 throw ' Sodium initialization failed.'
2532 }
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ switch ($true) {
3636$assemblyPath = Join-Path - Path $PSScriptRoot - ChildPath " libs/$runtimeIdentifier /PSModule.Sodium.dll"
3737Import-Module $assemblyPath - ErrorAction Stop
3838
39- if ($IsWindows ) {
40- $script :Supported = Assert-VisualCRedistributableInstalled - Version ' 14.0' - Architecture $processArchitecture.ToString ()
41- } else {
42- $script :Supported = $true
43- }
39+ # Optimistically mark supported; Initialize-Sodium will run the Windows VC++ runtime check lazily only if native init fails.
40+ $script :Supported = $true
41+ $script :ProcessArchitecture = $processArchitecture.ToString ()
You can’t perform that action at this time.
0 commit comments