diff --git a/internal/project/project.go b/internal/project/project.go index d0f43a9f..631b4674 100644 --- a/internal/project/project.go +++ b/internal/project/project.go @@ -193,7 +193,7 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [ var immediateSubprojects []Type for _, subprojectsFolderName := range subprojectsFolderNames { subprojectsPath := superproject.Path.Join(subprojectsFolderName) - if subprojectsPath.Exist() { + if subprojectsPath.IsDir() { directoryListing, err := subprojectsPath.ReadDir() if err != nil { panic(err) diff --git a/internal/project/project_test.go b/internal/project/project_test.go index aad77e65..787c0f05 100644 --- a/internal/project/project_test.go +++ b/internal/project/project_test.go @@ -429,3 +429,19 @@ func TestFindProjects(t *testing.T) { } } } + +func TestExamplefile(t *testing.T) { + // Set up directory structure of test library. + libraryPath, err := paths.TempDir().MkTempDir("TestExampleFile") + defer libraryPath.RemoveAll() // Clean up after the test. + require.Nil(t, err) + err = libraryPath.Join("TestExample.h").WriteFile([]byte{}) + require.Nil(t, err) + // Create an example file in the library folder. This should not cause a panic and should be ignored since it's not a folder containing the examples + err = libraryPath.Join("example").WriteFile([]byte{}) + require.Nil(t, err) + + configuration.Initialize(test.ConfigurationFlags(), []string{libraryPath.String()}) + + assert.NotPanics(t, func() { FindProjects() }, "Example file should not cause panic") +}
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: