Make profile dialogue platform independent

This commit is contained in:
Manuel Thalmann 2024-09-19 21:59:01 +02:00
parent c90e7faf11
commit 8ec34cb39e

View file

@ -51,7 +51,7 @@ $null = New-Module {
$profiles = & { $profiles = & {
. "$PSScriptRoot/SoftwareManagement.ps1"; . "$PSScriptRoot/SoftwareManagement.ps1";
if (Test-Command "wsl") { if (-not $IsWindows -or (Test-Command "wsl")) {
return Invoke-ConfigScript "getProfiles"; return Invoke-ConfigScript "getProfiles";
} else { } else {
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ }; return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
@ -61,6 +61,7 @@ $null = New-Module {
$choice = $Host.UI.PromptForChoice( $choice = $Host.UI.PromptForChoice(
"Select Profile", "Select Profile",
(& { (& {
if ($IsWindows) {
switch (Get-Stage) { switch (Get-Stage) {
([WindowsInstallerAction]::Backup) { ([WindowsInstallerAction]::Backup) {
"Which profile do you wish to back up?"; "Which profile do you wish to back up?";
@ -72,6 +73,9 @@ $null = New-Module {
"Which profile do you wish to set up?"; "Which profile do you wish to set up?";
} }
} }
} else {
"Please select a profile:";
}
}), }),
(& { (& {
for ($i = 0; $i -lt $profiles.Count; $i++) { for ($i = 0; $i -lt $profiles.Count; $i++) {