diff --git a/config.go b/config.go index c24377e..a45ced8 100644 --- a/config.go +++ b/config.go @@ -34,7 +34,7 @@ type Config struct { // Input defines the directory path, containing all asset files as // well as whether to recursively process assets in any sub directories. - Input InputConfig + Input []InputConfig // Output defines the output file for the generated code. // If left empty, this defaults to 'bindata.go' in the current @@ -140,13 +140,15 @@ func (c *Config) validate() error { return fmt.Errorf("Missing package name") } - stat, err := os.Lstat(c.Input.Path) - if err != nil { - return fmt.Errorf("Input path: %v", err) - } + for _, input := range c.Input { + stat, err := os.Lstat(input.Path) + if err != nil { + return fmt.Errorf("Failed to stat input path '%s': %v", input.Path, err) + } - if !stat.IsDir() { - return fmt.Errorf("Input path is not a directory.") + if !stat.IsDir() { + return fmt.Errorf("Input path '%s' is not a directory.", input.Path) + } } if len(c.Output) == 0 { @@ -158,7 +160,7 @@ func (c *Config) validate() error { c.Output = filepath.Join(cwd, "bindata.go") } - stat, err = os.Lstat(c.Output) + stat, err := os.Lstat(c.Output) if err != nil { if !os.IsNotExist(err) { return fmt.Errorf("Output path: %v", err) diff --git a/convert.go b/convert.go index aac6c9f..256cec1 100644 --- a/convert.go +++ b/convert.go @@ -26,9 +26,11 @@ func Translate(c *Config) error { } // Locate all the assets. - err = findFiles(c.Input.Path, c.Prefix, c.Input.Recursive, &toc) - if err != nil { - return err + for _, input := range c.Input { + err = findFiles(input.Path, c.Prefix, input.Recursive, &toc) + if err != nil { + return err + } } // Create output file. diff --git a/go-bindata/main.go b/go-bindata/main.go index 5b89460..3537004 100644 --- a/go-bindata/main.go +++ b/go-bindata/main.go @@ -60,7 +60,7 @@ func parseArgs() *bindata.Config { input := filepath.Clean(flag.Arg(0)) - c.Input = parseInput(input) + c.Input = []bindata.InputConfig{parseInput(input)} if flag.NArg() > 1 { c.Output = filepath.Clean(flag.Arg(1)) }