github.com/sneal/packer@v0.5.2/builder/virtualbox/common/floppy_config.go (about) 1 package common 2 3 import ( 4 "fmt" 5 6 "github.com/mitchellh/packer/packer" 7 ) 8 9 // FloppyConfig is configuration related to created floppy disks and attaching 10 // them to a VirtualBox machine. 11 type FloppyConfig struct { 12 FloppyFiles []string `mapstructure:"floppy_files"` 13 } 14 15 func (c *FloppyConfig) Prepare(t *packer.ConfigTemplate) []error { 16 if c.FloppyFiles == nil { 17 c.FloppyFiles = make([]string, 0) 18 } 19 20 errs := make([]error, 0) 21 for i, file := range c.FloppyFiles { 22 var err error 23 c.FloppyFiles[i], err = t.Process(file, nil) 24 if err != nil { 25 errs = append(errs, fmt.Errorf( 26 "Error processing floppy_files[%d]: %s", i, err)) 27 } 28 } 29 30 return errs 31 }