You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/packer/plugin_folders.go

28 lines
576 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package packer
import (
"log"
"os"
"path/filepath"
"github.com/hashicorp/packer-plugin-sdk/pathing"
)
// PluginFolder returns the known plugin folder based on system.
func PluginFolder() (string, error) {
if packerPluginPath := os.Getenv("PACKER_PLUGIN_PATH"); packerPluginPath != "" {
return packerPluginPath, nil
}
cd, err := pathing.ConfigDir()
if err != nil {
log.Printf("[ERR] Error loading config directory: %v", err)
return "", err
}
return filepath.Join(cd, "plugins"), nil
}