update installation instructions and add mpv handler setup script
This commit is contained in:
@@ -129,6 +129,29 @@ function Get-MpvPathFromConfig {
|
||||
}
|
||||
}
|
||||
|
||||
function Resolve-CommandPath {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string[]]$Names
|
||||
)
|
||||
|
||||
foreach ($name in $Names) {
|
||||
try {
|
||||
$command = Get-Command -Name $name -ErrorAction Stop
|
||||
if ($command.Path) {
|
||||
return $command.Path
|
||||
}
|
||||
|
||||
if ($command.Source) {
|
||||
return $command.Source
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
function Remove-ProtocolKey {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
@@ -204,7 +227,12 @@ $effectiveIconPath = if ($IconPath) {
|
||||
}
|
||||
(Resolve-Path -LiteralPath $IconPath).Path
|
||||
} else {
|
||||
Get-MpvPathFromConfig -ConfigPath $configPath
|
||||
$configuredPath = Get-MpvPathFromConfig -ConfigPath $configPath
|
||||
if ($configuredPath) {
|
||||
$configuredPath
|
||||
} else {
|
||||
Resolve-CommandPath -Names @('mpv.com', 'mpv.exe', 'mpv')
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $effectiveIconPath) {
|
||||
|
||||
Reference in New Issue
Block a user