PSGraph icon indicating copy to clipboard operation
PSGraph copied to clipboard

Detect graphViz outside of -GraphVizPath

Open endowdly opened this issue 7 years ago • 2 comments

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? :)

endowdly avatar Dec 14 '18 15:12 endowdly

That's a good idea.

KevinMarquette avatar Dec 16 '18 20:12 KevinMarquette

fwiw: to get dot's path, I currently use:

<# … #> -GraphVizPath (Get-Command dot).Source

endowdly avatar Dec 17 '18 21:12 endowdly