Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #707 from hashicorp/plugin-discover-home
Browse files Browse the repository at this point in the history
internal/plugin: support plugins in $HOME/.config/waypoint/plugins
  • Loading branch information
mitchellh authored Oct 26, 2020
2 parents e76525c + 5881c76 commit e671a1c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/plugin/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"

"github.com/adrg/xdg"
"github.com/mitchellh/go-homedir"

"github.com/hashicorp/waypoint/internal/config"
)
Expand Down Expand Up @@ -79,10 +80,20 @@ func DefaultPaths(pwd string) ([]string, error) {
return nil, err
}

// We also allow plugins in $HOME/.config/waypoint/plugins. This is
// usually the same as xdgPath but on some systems (macOS) without
// XDG env vars set, it defaults to a ~/Library path which can be weird.
// We just hardcode this path as well.
hd, err := homedir.Dir()
if err != nil {
return nil, err
}

return []string{
pwd,
filepath.Join(pwd, ".waypoint", "plugins"),
filepath.Dir(xdgPath),
filepath.Join(hd, ".config", ".waypoint", "plugins"),
}, nil
}

Expand Down

0 comments on commit e671a1c

Please sign in to comment.