Skip to content

Removed useless file-readable check while enumerating source code files #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions arduino/builder/internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"strings"
"unicode"

"github.com/arduino/arduino-cli/i18n"
f "github.com/arduino/arduino-cli/internal/algorithms"
"github.com/arduino/go-paths-helper"
"github.com/pkg/errors"
Expand All @@ -30,8 +29,6 @@ import (
"golang.org/x/text/unicode/norm"
)

var tr = i18n.Tr

// ObjFileIsUpToDate fixdoc
func ObjFileIsUpToDate(sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {
logrus.Debugf("Checking previous results for %v (result = %v, dep = %v)", sourceFile, objectFile, dependencyFile)
Expand Down Expand Up @@ -160,17 +157,6 @@ func filterOutSCCS(file *paths.Path) bool {
return !sourceControlFolders[file.Base()]
}

// filterReadableFiles is a ReadDirFilter that accepts only readable files
func filterReadableFiles(file *paths.Path) bool {
// See if the file is readable by opening it
f, err := file.Open()
if err != nil {
return false
}
f.Close()
return true
}

// filterOutHiddenFiles is a ReadDirFilter that exclude files with a "." prefix in their name
var filterOutHiddenFiles = paths.FilterOutPrefixes(".")

Expand All @@ -180,7 +166,6 @@ func FindFilesInFolder(dir *paths.Path, recurse bool, extensions ...string) (pat
filterOutHiddenFiles,
filterOutSCCS,
paths.FilterOutDirectories(),
filterReadableFiles,
)
if len(extensions) > 0 {
fileFilter = paths.AndFilter(
Expand Down