Commit 7853ec87 authored by Cristian Maglie's avatar Cristian Maglie

[skip-changelog] Removed useless file-readable check while enumerating source code files (#2418)

* Removed useless file filter

* Removed unused variable
parent 1c80c057
...@@ -20,7 +20,6 @@ import ( ...@@ -20,7 +20,6 @@ import (
"strings" "strings"
"unicode" "unicode"
"github.com/arduino/arduino-cli/i18n"
f "github.com/arduino/arduino-cli/internal/algorithms" f "github.com/arduino/arduino-cli/internal/algorithms"
"github.com/arduino/go-paths-helper" "github.com/arduino/go-paths-helper"
"github.com/pkg/errors" "github.com/pkg/errors"
...@@ -30,8 +29,6 @@ import ( ...@@ -30,8 +29,6 @@ import (
"golang.org/x/text/unicode/norm" "golang.org/x/text/unicode/norm"
) )
var tr = i18n.Tr
// ObjFileIsUpToDate fixdoc // ObjFileIsUpToDate fixdoc
func ObjFileIsUpToDate(sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) { func ObjFileIsUpToDate(sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {
logrus.Debugf("Checking previous results for %v (result = %v, dep = %v)", sourceFile, objectFile, dependencyFile) logrus.Debugf("Checking previous results for %v (result = %v, dep = %v)", sourceFile, objectFile, dependencyFile)
...@@ -160,17 +157,6 @@ func filterOutSCCS(file *paths.Path) bool { ...@@ -160,17 +157,6 @@ func filterOutSCCS(file *paths.Path) bool {
return !sourceControlFolders[file.Base()] 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 // filterOutHiddenFiles is a ReadDirFilter that exclude files with a "." prefix in their name
var filterOutHiddenFiles = paths.FilterOutPrefixes(".") var filterOutHiddenFiles = paths.FilterOutPrefixes(".")
...@@ -180,7 +166,6 @@ func FindFilesInFolder(dir *paths.Path, recurse bool, extensions ...string) (pat ...@@ -180,7 +166,6 @@ func FindFilesInFolder(dir *paths.Path, recurse bool, extensions ...string) (pat
filterOutHiddenFiles, filterOutHiddenFiles,
filterOutSCCS, filterOutSCCS,
paths.FilterOutDirectories(), paths.FilterOutDirectories(),
filterReadableFiles,
) )
if len(extensions) > 0 { if len(extensions) > 0 {
fileFilter = paths.AndFilter( fileFilter = paths.AndFilter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment