github.com/sneal/packer@v0.5.2/builder/vmware/common/driver_config.go (about) 1 package common 2 3 import ( 4 "fmt" 5 6 "github.com/mitchellh/packer/packer" 7 ) 8 9 type DriverConfig struct { 10 FusionAppPath string `mapstructure:"fusion_app_path"` 11 } 12 13 func (c *DriverConfig) Prepare(t *packer.ConfigTemplate) []error { 14 if c.FusionAppPath == "" { 15 c.FusionAppPath = "/Applications/VMware Fusion.app" 16 } 17 18 templates := map[string]*string{ 19 "fusion_app_path": &c.FusionAppPath, 20 } 21 22 var err error 23 errs := make([]error, 0) 24 for n, ptr := range templates { 25 *ptr, err = t.Process(*ptr, nil) 26 if err != nil { 27 errs = append(errs, fmt.Errorf("Error processing %s: %s", n, err)) 28 } 29 } 30 31 return errs 32 }