diff --git a/internal/io/io.go b/internal/io/io.go index 6812410d5..701fb8a39 100644 --- a/internal/io/io.go +++ b/internal/io/io.go @@ -135,6 +135,8 @@ func WalkFiles(root string, f func(path string) error) error { }) } +// FindManifestLocations walks the file system rooted at root, and returns the +// *relative* paths of directories containing a .manifest file. func FindManifestLocations(root string) ([]string, error) { var foundBundleRoots []string diff --git a/pkg/config/config.go b/pkg/config/config.go index b4ab90936..3b4f68776 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -219,12 +219,6 @@ func FindBundleRootDirectories(path string) ([]string, error) { foundBundleRoots = append(foundBundleRoots, roots...) } - // rather than calling rio.FindManifestLocations later, let's - // check for .manifest directories as part of the same walk - if !info.IsDir() && info.Name() == ".manifest" { - foundBundleRoots = append(foundBundleRoots, filepath.Dir(path)) - } - return nil }); err != nil { return nil, fmt.Errorf("failed to walk path: %w", err) @@ -268,6 +262,13 @@ func rootsFromRegalDirectory(regalDir *os.File) ([]string, error) { foundBundleRoots = append(foundBundleRoots, customRulesDir) } + manifestRoots, err := rio.FindManifestLocations(filepath.Dir(regalDir.Name())) + if err != nil { + return nil, fmt.Errorf("failed while looking for manifest locations: %w", err) + } + + foundBundleRoots = append(foundBundleRoots, util.Map(util.FilepathJoiner(parent), manifestRoots)...) + return foundBundleRoots, nil }