Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: client/internal/common/filesystem_view.go

Issue 2981223003: Reuse blacklisting code in exp_archive. (Closed)
Patch Set: address review comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/cmd/isolate/exp_archive_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/internal/common/filesystem_view.go
diff --git a/client/internal/common/filesystem_view.go b/client/internal/common/filesystem_view.go
index 42bd5022495d6430ea7f59dbedebafaac95ececb..5f60a831559a828c81d7d87c5a813181d3c92b72 100644
--- a/client/internal/common/filesystem_view.go
+++ b/client/internal/common/filesystem_view.go
@@ -16,6 +16,7 @@ package common
import (
"fmt"
+ "os"
"path/filepath"
)
@@ -79,3 +80,16 @@ func match(pattern, name string) bool {
matched, _ := filepath.Match(pattern, name)
return matched
}
+
+// WalkFuncSkipFile is a helper for implemenations of filepath.WalkFunc. The
+// value that it returns may in turn be returned by the WalkFunc implementaiton
+// to indicate that file should be skipped.
+func WalkFuncSkipFile(file os.FileInfo) error {
+ if file.IsDir() {
+ return filepath.SkipDir
+ }
+ // If we were to return SkipDir for a file, it would cause
+ // filepath.Walk to skip the file's containing directory, which we do
+ // not want (see https://golang.org/pkg/path/filepath/#WalkFunc).
+ return nil
+}
« no previous file with comments | « client/cmd/isolate/exp_archive_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698