OP.psm1
|
$CommandsPath = Join-Path $PSScriptRoot 'Commands' foreach ($file in Get-ChildItem -Path $CommandsPath -Filter '*-*.ps1') { if ($file.Name -like '*.*.ps1') { continue } . $file.FullName } if (-not ('IO.Packaging.Package' -as [type])) { if ($psVersionTable.PSVersion -ge '6.0') { $addedTypes = Add-type -AssemblyName System.IO.Packaging -PassThru $packageTypeFound = $addedTypes | Where-Object FullName -eq 'System.IO.Packaging.Package' if (-not $packageTypeFound) { Write-Warning "Could not find [System.IO.Packaging.Package]" } } else { Write-Warning ( @( "System.IO.Packaging.Package is not included with Windows PowerShell." "Please download System.IO.Packaging from Nuget:" "https://www.nuget.org/packages/System.IO.Packaging/" ) -join [Environment]::NewLine ) } } if (-not $env:OpenPackagePath) { $env:OpenPackagePath = Join-Path $home OpenPackage } |