aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2015-10-20 21:54:34 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-10-21 14:39:08 +0000
commitd8b6ff2dad1de2d98a407ecf67a34fe12e67d494 (patch)
tree030c5ebb89ca5835e76854ed51c0d2a75b04e4e3 /src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
parent11ef8fc44821fb593a512eb5a3423013abbe39aa (diff)
Introduce Path#isSpecialFile, FileSystem#isSpecialFile, and FileStatus#isSpecialFile to help disambiguate between a regular file and a special file, since the file size of a special file cannot be trusted.
-- MOS_MIGRATED_REVID=105903622
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java46
1 files changed, 6 insertions, 40 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
index 3ae4e96749..9d9f16e5ae 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
@@ -94,34 +94,6 @@ public class JavaIoFileSystem extends AbstractFileSystem {
}
@Override
- protected boolean isDirectory(Path path, boolean followSymlinks) {
- File file = getIoFile(path);
- long startTime = Profiler.nanoTimeMaybe();
- try {
- if (!followSymlinks && fileIsSymbolicLink(file)) {
- return false;
- }
- return file.isDirectory();
- } finally {
- profiler.logSimpleTask(startTime, ProfilerTask.VFS_STAT, path.toString());
- }
- }
-
- @Override
- protected boolean isFile(Path path, boolean followSymlinks) {
- File file = getIoFile(path);
- long startTime = Profiler.nanoTimeMaybe();
- try {
- if (!followSymlinks && fileIsSymbolicLink(file)) {
- return false;
- }
- return file.isFile();
- } finally {
- profiler.logSimpleTask(startTime, ProfilerTask.VFS_STAT, path.toString());
- }
- }
-
- @Override
protected boolean isReadable(Path path) throws IOException {
File file = getIoFile(path);
long startTime = Profiler.nanoTimeMaybe();
@@ -365,17 +337,6 @@ public class JavaIoFileSystem extends AbstractFileSystem {
}
}
- @Override
- protected boolean isSymbolicLink(Path path) {
- File file = getIoFile(path);
- long startTime = Profiler.nanoTimeMaybe();
- try {
- return fileIsSymbolicLink(file);
- } finally {
- profiler.logSimpleTask(startTime, ProfilerTask.VFS_STAT, file.getPath());
- }
- }
-
private boolean fileIsSymbolicLink(File file) {
return Files.isSymbolicLink(file.toPath());
}
@@ -428,7 +389,12 @@ public class JavaIoFileSystem extends AbstractFileSystem {
FileStatus status = new FileStatus() {
@Override
public boolean isFile() {
- return attributes.isRegularFile();
+ return attributes.isRegularFile() || isSpecialFile();
+ }
+
+ @Override
+ public boolean isSpecialFile() {
+ return attributes.isOther();
}
@Override