From 34601bd7eb6f9fcffb51a520e895d644caba336b Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:46:39 +1200 Subject: [PATCH] feat(installer-pwsh): validate profiles.ini files exist --- Install.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index bf9a958..809ca3f 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -61,6 +61,7 @@ param( # Constants $PSMinSupportedVersion = 2 $DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") +$ProfileInfoFile = "profiles.ini" function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' @@ -196,9 +197,18 @@ function Check-FirefoxProfileDirectories { return $FirefoxInstalls } -function Check-FirefoxProfileDirectories { - param ([string]$CustomProfilePath) - # TODO: stub +function Check-FirefoxProfileConfigurations { + param ([string[]]$InstallDirectories) + 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 { @@ -226,7 +236,7 @@ function Install-Lepton { $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath # TODO: check profile ini files exists - #Check-FirefoxProfileConfigurations $InstallationDirectories + Check-FirefoxProfileConfigurations $InstallationDirectories # TODO: read profile paths in from profiles.ini files #$AsboluteProfilePaths = Get-FirefoxProfilePaths