func collectAllSketchFiles(from string) ([]string, error) { filePaths := []string{} // Source files in the root are compiled, non-recursively. This // is the only place where .ino files can be present. rootExtensions := func(ext string) bool { return MAIN_FILE_VALID_EXTENSIONS[ext] || ADDITIONAL_FILE_VALID_EXTENSIONS[ext] } err := utils.FindFilesInFolder(&filePaths, from, rootExtensions, true /* recurse */) if err != nil { return nil, i18n.WrapError(err) } return filePaths, i18n.WrapError(err) }
func queueSourceFilesFromFolder(ctx *types.Context, queue *types.UniqueSourceFileQueue, origin interface{}, folder string, recurse bool) error { extensions := func(ext string) bool { return ADDITIONAL_FILE_VALID_EXTENSIONS_NO_HEADERS[ext] } filePaths := []string{} err := utils.FindFilesInFolder(&filePaths, folder, extensions, recurse) if err != nil { return i18n.WrapError(err) } for _, filePath := range filePaths { sourceFile, err := types.MakeSourceFile(ctx, origin, filePath) if err != nil { return i18n.WrapError(err) } queue.Push(sourceFile) } return nil }