mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
66ebff90cd
Make less to change when we remove the old search path
26 lines
734 B
Go
26 lines
734 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"path/filepath"
|
|
)
|
|
|
|
// globalPluginDirs returns directories that should be searched for
|
|
// globally-installed plugins (not specific to the current configuration).
|
|
//
|
|
// Earlier entries in this slice get priority over later when multiple copies
|
|
// of the same plugin version are found, but newer versions always override
|
|
// older versions where both satisfy the provider version constraints.
|
|
func globalPluginDirs() []string {
|
|
var ret []string
|
|
// Look in ~/.terraform.d/plugins/ , or its equivalent on non-UNIX
|
|
dir, err := ConfigDir()
|
|
if err != nil {
|
|
log.Printf("[ERROR] Error finding global config directory: %s", err)
|
|
} else {
|
|
ret = append(ret, filepath.Join(dir, "plugins"))
|
|
}
|
|
|
|
return ret
|
|
}
|