@@ -61,10 +61,10 @@ func FindProjects() ([]Type, error) {
61
61
}
62
62
63
63
// findProjectsUnderPath finds projects of the given type and subprojects of those projects. It returns a slice containing the definitions of all found projects.
64
- func findProjectsUnderPath (targetPath * paths.Path , projectType projecttype.Type , recursive bool ) []Type {
64
+ func findProjectsUnderPath (targetPath * paths.Path , projectTypeFilter projecttype.Type , recursive bool ) []Type {
65
65
var foundProjects []Type
66
66
67
- isProject , foundProjectType := isProject (targetPath , projectType )
67
+ isProject , foundProjectType := isProject (targetPath , projectTypeFilter )
68
68
if isProject {
69
69
logrus .Tracef ("%s is %s" , targetPath , foundProjectType )
70
70
foundProject := Type {
@@ -86,7 +86,7 @@ func findProjectsUnderPath(targetPath *paths.Path, projectType projecttype.Type,
86
86
directoryListing , _ := targetPath .ReadDir ()
87
87
directoryListing .FilterDirs ()
88
88
for _ , potentialProjectDirectory := range directoryListing {
89
- foundProjects = append (foundProjects , findProjectsUnderPath (potentialProjectDirectory , projectType , recursive )... )
89
+ foundProjects = append (foundProjects , findProjectsUnderPath (potentialProjectDirectory , projectTypeFilter , recursive )... )
90
90
}
91
91
}
92
92
@@ -141,37 +141,37 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [
141
141
}
142
142
143
143
// isProject determines if a path contains an Arduino project, and if so which type.
144
- func isProject (potentialProjectPath * paths.Path , projectType projecttype.Type ) (bool , projecttype.Type ) {
145
- logrus .Tracef ("Checking if %s is %s" , potentialProjectPath , projectType )
146
- if projectType .Matches (projecttype .Sketch ) && isSketch (potentialProjectPath ) {
144
+ func isProject (potentialProjectPath * paths.Path , projectTypeFilter projecttype.Type ) (bool , projecttype.Type ) {
145
+ logrus .Tracef ("Checking if %s is %s" , potentialProjectPath , projectTypeFilter )
146
+ if projectTypeFilter .Matches (projecttype .Sketch ) && isSketch (potentialProjectPath ) {
147
147
logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Sketch )
148
148
return true , projecttype .Sketch
149
- } else if projectType .Matches (projecttype .Library ) && isLibrary (potentialProjectPath ) {
149
+ } else if projectTypeFilter .Matches (projecttype .Library ) && isLibrary (potentialProjectPath ) {
150
150
logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Library )
151
151
return true , projecttype .Library
152
- } else if projectType .Matches (projecttype .Platform ) && isPlatform (potentialProjectPath ) {
152
+ } else if projectTypeFilter .Matches (projecttype .Platform ) && isPlatform (potentialProjectPath ) {
153
153
logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Platform )
154
154
return true , projecttype .Platform
155
- } else if projectType .Matches (projecttype .PackageIndex ) && isPackageIndex (potentialProjectPath ) {
155
+ } else if projectTypeFilter .Matches (projecttype .PackageIndex ) && isPackageIndex (potentialProjectPath ) {
156
156
logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .PackageIndex )
157
157
return true , projecttype .PackageIndex
158
158
}
159
159
return false , projecttype .Not
160
160
}
161
161
162
162
// isProject determines if a file is the indicator file for an Arduino project, and if so which type.
163
- func isProjectIndicatorFile (potentialProjectFilePath * paths.Path , projectType projecttype.Type ) (bool , projecttype.Type ) {
164
- logrus .Tracef ("Checking if %s is %s indicator file" , potentialProjectFilePath , projectType )
165
- if projectType .Matches (projecttype .Sketch ) && isSketchIndicatorFile (potentialProjectFilePath ) {
163
+ func isProjectIndicatorFile (potentialProjectFilePath * paths.Path , projectTypeFilter projecttype.Type ) (bool , projecttype.Type ) {
164
+ logrus .Tracef ("Checking if %s is %s indicator file" , potentialProjectFilePath , projectTypeFilter )
165
+ if projectTypeFilter .Matches (projecttype .Sketch ) && isSketchIndicatorFile (potentialProjectFilePath ) {
166
166
logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Sketch )
167
167
return true , projecttype .Sketch
168
- } else if projectType .Matches (projecttype .Library ) && isLibraryIndicatorFile (potentialProjectFilePath ) {
168
+ } else if projectTypeFilter .Matches (projecttype .Library ) && isLibraryIndicatorFile (potentialProjectFilePath ) {
169
169
logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Library )
170
170
return true , projecttype .Library
171
- } else if projectType .Matches (projecttype .Platform ) && isPlatformIndicatorFile (potentialProjectFilePath ) {
171
+ } else if projectTypeFilter .Matches (projecttype .Platform ) && isPlatformIndicatorFile (potentialProjectFilePath ) {
172
172
logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Platform )
173
173
return true , projecttype .Platform
174
- } else if projectType .Matches (projecttype .PackageIndex ) && isPackageIndexIndicatorFile (potentialProjectFilePath ) {
174
+ } else if projectTypeFilter .Matches (projecttype .PackageIndex ) && isPackageIndexIndicatorFile (potentialProjectFilePath ) {
175
175
logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .PackageIndex )
176
176
return true , projecttype .PackageIndex
177
177
}
0 commit comments