mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-03 20:39:29 -05:00
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
25 lines
421 B
Go
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)
|
|
}
|