PSGraph
PSGraph copied to clipboard
Detect graphViz outside of -GraphVizPath
We have:
$GraphVizPath = (
'C:\Program Files\NuGet\Packages\Graphviz*\dot.exe',
'C:\program files*\GraphViz*\bin\dot.exe',
'/usr/local/bin/dot'
),
…which of course we can change.
Why not something like...
$isGraphviz =
try {
Get-Command dot -CommandType Application -ErrorAction Stop > $null
$true
catch {
$false
}
if (-not $isGraphviz) {
$graphViz =
Resolve-Path -Path $GraphVizPath -ErrorAction SilentlyContinue |
Get-Item |
Where-Object BaseName -eq 'dot' | # PS -- don't need quotes here
Select-Object -First 1
}
...so dot's path can be snagged straight from my env:\path without having to enter it in manually every time? :)
That's a good idea.
fwiw: to get dot's path, I currently use:
<# … #> -GraphVizPath (Get-Command dot).Source