Skip to content

Detect graphViz outside of -GraphVizPath #88

Description

@endowdly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions