feat(installer-pwsh): validate profiles.ini files exist

This commit is contained in:
James Upjohn 2021-07-15 21:46:39 +12:00
parent 1cc4cdb2e8
commit 34601bd7eb
No known key found for this signature in database
GPG key ID: D27176569247601C

View file

@ -61,6 +61,7 @@ param(
# Constants # Constants
$PSMinSupportedVersion = 2 $PSMinSupportedVersion = 2
$DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") $DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/")
$ProfileInfoFile = "profiles.ini"
function Check-Help { function Check-Help {
# Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help'
@ -196,9 +197,18 @@ function Check-FirefoxProfileDirectories {
return $FirefoxInstalls return $FirefoxInstalls
} }
function Check-FirefoxProfileDirectories { function Check-FirefoxProfileConfigurations {
param ([string]$CustomProfilePath) param ([string[]]$InstallDirectories)
# TODO: stub Write-Host -Nonewline "Checking profile info files... "
foreach ($Install in $InstallDirectories) {
if (-not ($Test-Path -Path (-Join $Install, "\", $ProfileInfoFile))) {
Write-Error "Unable to find $ProfileInfoFile for install $Install"
exit -1
}
}
Write-Host "[found]"
} }
function Check-FirefoxProfileConfigurations { function Check-FirefoxProfileConfigurations {
@ -226,7 +236,7 @@ function Install-Lepton {
$InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath
# TODO: check profile ini files exists # TODO: check profile ini files exists
#Check-FirefoxProfileConfigurations $InstallationDirectories Check-FirefoxProfileConfigurations $InstallationDirectories
# TODO: read profile paths in from profiles.ini files # TODO: read profile paths in from profiles.ini files
#$AsboluteProfilePaths = Get-FirefoxProfilePaths #$AsboluteProfilePaths = Get-FirefoxProfilePaths