mirror of
https://github.com/black7375/Firefox-UI-Fix.git
synced 2025-12-06 02:30:54 -08:00
feat(installer-pwsh): check Firefox installation directories
This commit is contained in:
parent
33752d99f9
commit
1cc4cdb2e8
1 changed files with 34 additions and 1 deletions
35
Install.ps1
35
Install.ps1
|
|
@ -60,6 +60,7 @@ param(
|
|||
|
||||
# Constants
|
||||
$PSMinSupportedVersion = 2
|
||||
$DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/")
|
||||
|
||||
function Check-Help {
|
||||
# Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help'
|
||||
|
|
@ -163,6 +164,38 @@ function Select-LeptonDistribution {
|
|||
}
|
||||
}
|
||||
|
||||
function Get-TestedPaths {
|
||||
param ([string[]]$Paths)
|
||||
|
||||
$FoundPaths = @()
|
||||
foreach ($pathItem in $Paths) {
|
||||
if ($Test-Path -Path $pathItem) {
|
||||
$FoundPaths += $pathItem
|
||||
}
|
||||
}
|
||||
|
||||
return $FoundPaths
|
||||
}
|
||||
|
||||
function Check-FirefoxProfileDirectories {
|
||||
param ([string]$CustomProfilePath)
|
||||
|
||||
Write-Host -Nonewline "Checking Firefox profile directories... "
|
||||
|
||||
$FirefoxProfilePaths = $DefaultFirefoxProfilePaths
|
||||
$FirefoxProfilePaths += $CustomProfilePath
|
||||
|
||||
$FirefoxInstalls = Get-TestedPaths -Paths $FirefoxProfilePaths
|
||||
if ($FirefoxInstalls.Length -eq 0) {
|
||||
Write-Host "[not found]"
|
||||
Write-Error "Unable to find Firefox installations"
|
||||
exit -1
|
||||
}
|
||||
|
||||
Write-Host "[found]"
|
||||
return $FirefoxInstalls
|
||||
}
|
||||
|
||||
function Check-FirefoxProfileDirectories {
|
||||
param ([string]$CustomProfilePath)
|
||||
# TODO: stub
|
||||
|
|
@ -190,7 +223,7 @@ function Install-Lepton {
|
|||
$SelectedDistribution = Select-LeptonDistribution
|
||||
|
||||
# TODO: check profile director{y,ies} (including custom)
|
||||
#$InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath
|
||||
$InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath
|
||||
|
||||
# TODO: check profile ini files exists
|
||||
#Check-FirefoxProfileConfigurations $InstallationDirectories
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue