Fix b/1753517: Hidden Folders should not be crawled.
This fixes a bug in NioFileDelegate.isHidden().
It seems that NIO Files.isHidden(Path) does not consider hidden
folders to be hidden. From the NIO Files javadoc:
"On Windows a file is considered hidden if it isn't a directory
and the DOS hidden attribute is set."
I don't know why Sun/Oracle decided to exclude hidden directories.
Consequently, I changed the implementation to use File.isHidden(),
which does pay attention to the hidden attribute on directories.
Code Review: http://codereview.appspot.com/85580045
diff --git a/src/com/google/enterprise/adaptor/fs/NioFileDelegate.java b/src/com/google/enterprise/adaptor/fs/NioFileDelegate.java
index 80bdbe8..84ab250 100644
--- a/src/com/google/enterprise/adaptor/fs/NioFileDelegate.java
+++ b/src/com/google/enterprise/adaptor/fs/NioFileDelegate.java
@@ -53,7 +53,9 @@
@Override
public boolean isHidden(Path doc) throws IOException {
- return Files.isHidden(doc);
+ // Using File.isHidden() because NIO Files.isHidden(Path) does not
+ // consider hidden directories to be hidden.
+ return doc.toFile().isHidden();
}
@Override