databricks-cli/bundle/config/resources/pkg.go

20 lines
446 B
Go
Raw Normal View History

package resources
import (
"fmt"
"path/filepath"
)
type Paths struct {
// ConfigFilePath holds the path to the configuration file that
// described the resource that this type is embedded in.
ConfigFilePath string `json:"-" bundle:"readonly"`
}
func (p *Paths) ConfigFileDirectory() (string, error) {
if p.ConfigFilePath == "" {
return "", fmt.Errorf("config file path not configured")
}
return filepath.Dir(p.ConfigFilePath), nil
}