Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #246 from flcdrg/install-with-core
Browse files Browse the repository at this point in the history
Enable installing with PowerShell Core/7+
  • Loading branch information
majkinetor authored May 22, 2021
2 parents 971177e + a4ee92d commit cb04813
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ param(
$ErrorActionPreference = 'Stop'

$module_name = 'AU'
$module_dst = "$Env:ProgramFiles\WindowsPowerShell\Modules"

if ($PSVersionTable.PSEdition -ne "Core") {
$module_dst = "$Env:ProgramFiles\WindowsPowerShell\Modules"
} else {
$module_dst = "$Env:ProgramFiles\PowerShell\Modules"
}

Remove-Item -Force -Recurse "$module_dst\$module_name" -ErrorAction ignore
if ($Remove) { remove-module $module_name -ea ignore; Write-Host "Module $module_name removed"; return }
Expand All @@ -41,6 +46,8 @@ if (!(Test-Path $module_path)) { throw "Module path invalid: '$module_path'" }

Write-Host "Module path: '$module_path'"

New-Item -ItemType Directory "$module_dst/$module_name" -ErrorAction Ignore | Out-Null

Copy-Item -Recurse -Force $module_path $module_dst

$res = Get-Module $module_name -ListAvailable | Where-Object { (Split-Path $_.ModuleBase) -eq $module_dst }
Expand Down

0 comments on commit cb04813

Please sign in to comment.