in packages/package.go [503:542]
func (p *Package) LoadAssets() (err error) {
fs, err := p.fs()
if err != nil {
return err
}
defer fs.Close()
// Reset Assets
p.Assets = nil
// Iterates recursively through all the levels to find assets
// If we need more complex matching a library like https://github.com/bmatcuk/doublestar
// could be used but the below works and is pretty simple.
assets, err := collectAssets(fs, "*")
if err != nil {
return err
}
for _, a := range assets {
// Unfortunately these files keep sneaking in
if strings.Contains(a, ".DS_Store") {
continue
}
info, err := fs.Stat(a)
if err != nil {
return err
}
if info.IsDir() {
if strings.Contains(info.Name(), "-") {
return fmt.Errorf("directory name inside package %s contains -: %s", p.Name, a)
}
continue
}
a = path.Join(packagePathPrefix, p.GetPath(), a)
p.Assets = append(p.Assets, a)
}
return nil
}