Ensure the KnownFolders
module is imported before use
This commit is contained in:
parent
ba1d13d7ee
commit
1b87ddfabb
5 changed files with 23 additions and 3 deletions
3
scripts/Windows/Scripts/KnownFolders.ps1
Normal file
3
scripts/Windows/Scripts/KnownFolders.ps1
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/Modules.ps1" KnownFolders;
|
||||
Import-Module KnownFolders;
|
17
scripts/Windows/Scripts/Modules.ps1
Normal file
17
scripts/Windows/Scripts/Modules.ps1
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/pwsh
|
||||
param (
|
||||
[string]$ModuleName,
|
||||
[switch]$WindowsPowerShell
|
||||
)
|
||||
|
||||
if ($WindowsPowerShell) {
|
||||
if (-not (powershell -c Get-Module -ListAvailable $ModuleName)) {
|
||||
Write-Host "Installing Windows PowerShell Module $ModuleName";
|
||||
powershell -c Install-Module -Force "$ModuleName";
|
||||
}
|
||||
} else {
|
||||
if (-not (Get-Module -ListAvailable $ModuleName)) {
|
||||
Write-Host "Installing PowerShell Module $ModuleName";
|
||||
Install-Module -AcceptLicense -Force "$ModuleName";
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ if (-not $?) {
|
|||
powershell -c '$null = Install-PackageProvider -Name NuGet -Force';
|
||||
}
|
||||
|
||||
foreach ($module in @("PSWindowsUpdate", "KnownFolders"))
|
||||
foreach ($module in @("PSWindowsUpdate"))
|
||||
{
|
||||
if (-not (Get-Module -ListAvailable $module))
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
Import-Module "KnownFolders";
|
||||
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
|
||||
$path = "C:/tools/RetroArch-Win64";
|
||||
$softwareName = "RetroArch";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/pwsh
|
||||
Import-Module "KnownFolders";
|
||||
. "$PSScriptRoot/../../Scripts/KnownFolders.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
|
|
Loading…
Reference in a new issue