From 32a26df5a5c0be7a40815ff5e05eb3256bc52ef9 Mon Sep 17 00:00:00 2001 From: Max Renner Date: Mon, 23 Aug 2021 21:06:09 -0500 Subject: [PATCH] Corrected SCOPE paths for PS7 (Windows and Mac) --- InstallModuleFromGitHub.psm1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/InstallModuleFromGitHub.psm1 b/InstallModuleFromGitHub.psm1 index 7713e75..ea15d76 100644 --- a/InstallModuleFromGitHub.psm1 +++ b/InstallModuleFromGitHub.psm1 @@ -59,16 +59,20 @@ function Install-ModuleFromGitHub { Write-Debug "targetModule: $targetModule" if ([System.Environment]::OSVersion.Platform -eq "Unix") { - $dest = Join-Path -Path $HOME -ChildPath ".local/share/powershell/Modules" + if ($Scope = "CurrentUser") { + $dest = Join-Path -Path $HOME -ChildPath ".local/share/powershell/Modules" + } else { + $dest = "/usr/local/share/powershell/Modules" + } } else { if ($Scope = "CurrentUser") { $scopedPath = $HOME - $scopedChildPath = "\Documents\WindowsPowerShell\Modules" + $scopedChildPath = "\Documents\PowerShell\Modules" } else { $scopedPath = $env:ProgramFiles - $scopedChildPath = "\WindowsPowerShell\Modules" + $scopedChildPath = "\PowerShell\Modules" } $dest = Join-Path -Path $scopedPath -ChildPath $scopedChildPath } @@ -81,8 +85,7 @@ function Install-ModuleFromGitHub { $psd1 = Get-ChildItem (Join-Path -Path $unzippedArchive -ChildPath *) -Include *.psd1 -Recurse } else { $psd1 = Get-ChildItem (Join-Path -Path $tmpDir -ChildPath $unzippedArchive) -Include *.psd1 -Recurse - } - + } if($psd1) { $ModuleVersion=(Get-Content -Raw $psd1.FullName | Invoke-Expression).ModuleVersion