@@ -143,40 +143,46 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [
143
143
// isProject determines if a path contains an Arduino project, and if so which type.
144
144
func isProject (potentialProjectPath * paths.Path , projectTypeFilter projecttype.Type ) (bool , projecttype.Type ) {
145
145
logrus .Tracef ("Checking if %s is %s" , potentialProjectPath , projectTypeFilter )
146
+
147
+ projectType := projecttype .Not
146
148
if projectTypeFilter .Matches (projecttype .Sketch ) && isSketch (potentialProjectPath ) {
147
- logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Sketch )
148
- return true , projecttype .Sketch
149
+ projectType = projecttype .Sketch
149
150
} else if projectTypeFilter .Matches (projecttype .Library ) && isLibrary (potentialProjectPath ) {
150
- logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Library )
151
- return true , projecttype .Library
151
+ projectType = projecttype .Library
152
152
} else if projectTypeFilter .Matches (projecttype .Platform ) && isPlatform (potentialProjectPath ) {
153
- logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .Platform )
154
- return true , projecttype .Platform
153
+ projectType = projecttype .Platform
155
154
} else if projectTypeFilter .Matches (projecttype .PackageIndex ) && isPackageIndex (potentialProjectPath ) {
156
- logrus .Tracef ("%s is %s" , potentialProjectPath , projecttype .PackageIndex )
157
- return true , projecttype .PackageIndex
155
+ projectType = projecttype .PackageIndex
156
+ }
157
+
158
+ if projectType == projecttype .Not {
159
+ return false , projectType
158
160
}
159
- return false , projecttype .Not
161
+ logrus .Tracef ("%s is %s" , potentialProjectPath , projectType )
162
+ return true , projectType
160
163
}
161
164
162
165
// isProject determines if a file is the indicator file for an Arduino project, and if so which type.
163
166
func isProjectIndicatorFile (potentialProjectFilePath * paths.Path , projectTypeFilter projecttype.Type ) (bool , projecttype.Type ) {
164
167
logrus .Tracef ("Checking if %s is %s indicator file" , potentialProjectFilePath , projectTypeFilter )
168
+
169
+ projectType := projecttype .Not
165
170
if projectTypeFilter .Matches (projecttype .Sketch ) && isSketchIndicatorFile (potentialProjectFilePath ) {
166
- logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Sketch )
167
- return true , projecttype .Sketch
171
+ projectType = projecttype .Sketch
168
172
} else if projectTypeFilter .Matches (projecttype .Library ) && isLibraryIndicatorFile (potentialProjectFilePath ) {
169
- logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Library )
170
- return true , projecttype .Library
173
+ projectType = projecttype .Library
171
174
} else if projectTypeFilter .Matches (projecttype .Platform ) && isPlatformIndicatorFile (potentialProjectFilePath ) {
172
- logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .Platform )
173
- return true , projecttype .Platform
175
+ projectType = projecttype .Platform
174
176
} else if projectTypeFilter .Matches (projecttype .PackageIndex ) && isPackageIndexIndicatorFile (potentialProjectFilePath ) {
175
- logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projecttype .PackageIndex )
176
- return true , projecttype .PackageIndex
177
+ projectType = projecttype .PackageIndex
178
+ }
179
+
180
+ if projectType == projecttype .Not {
181
+ logrus .Tracef ("%s is not indicator file" , potentialProjectFilePath )
182
+ return false , projectType
177
183
}
178
- logrus .Tracef ("%s is not indicator file" , potentialProjectFilePath )
179
- return false , projecttype . Not
184
+ logrus .Tracef ("%s is %s indicator file" , potentialProjectFilePath , projectType )
185
+ return true , projectType
180
186
}
181
187
182
188
// isSketch determines whether a path is an Arduino sketch.
0 commit comments