From 6cddce4dcf00debfbc6361399f1b50e4406111a3 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:47:37 +1200 Subject: [PATCH] feat(installer-pwsh): extract profile paths from profiles.ini files --- Install.ps1 | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 809ca3f..7d0e07e 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -211,13 +211,23 @@ function Check-FirefoxProfileConfigurations { Write-Host "[found]" } -function Check-FirefoxProfileConfigurations { - param ([string[]]$InstallDirectories) - # TODO: stub -} - function Get-FirefoxProfilePaths { - # TODO: stub + param ([string[]]$InstallDirectories) + + Write-Host -Nonewline "Checking path information for profiles... " + + $AbsoluteProfiles = @() + + foreach ($Directory in $InstallDirectories) { + $InfoFileContents = (Get-Content -Path (-Join $Directory, "\", $ProfileInfoFile)) -Split "\n" + $PathNames = $InfoFileContents + .Where({$_ -Match "Path=.+"}) + .ForEach({$_ -Replace "Path=",""}) + .ForEach({$AbsoluteProfiles += (-Join $Directory, "\", $_)}) + } + + # TODO: error handling + return $AbsoluteProfiles } function Install-LeptonToProfiles { @@ -239,7 +249,7 @@ function Install-Lepton { Check-FirefoxProfileConfigurations $InstallationDirectories # TODO: read profile paths in from profiles.ini files - #$AsboluteProfilePaths = Get-FirefoxProfilePaths + $AsboluteProfilePaths = Get-FirefoxProfilePaths # TODO: install if in install mode #Install-LeptonToProfiles $AbsoluteProfilePaths