packer/command/utils.go
hashicorp-copywrite[bot] b7df3ca36f
[COMPLIANCE] Add Copyright and License Headers (#12254)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00

25 lines
421 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package command
import (
"os"
"strings"
)
func isDir(name string) (bool, error) {
s, err := os.Stat(name)
if err != nil {
return false, err
}
return s.IsDir(), nil
}
func isHCLLoaded(name string) (bool, error) {
if strings.HasSuffix(name, ".pkr.hcl") ||
strings.HasSuffix(name, ".pkr.json") {
return true, nil
}
return isDir(name)
}