aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs
diff options
context:
space:
mode:
authorGravatar Xin Gao <xingao@google.com>2016-09-22 22:08:01 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-23 08:15:57 +0000
commitaf042f7a5ff29a8775de7019f429ff917b583c32 (patch)
tree6d89bc4e04f4de9dad4c599ff5203f134d925891 /src/main/java/com/google/devtools/build/lib/vfs
parentd9f2d8599207bd8d16e3046e5443132b95a2952d (diff)
Fixed symbolic link and hard link path not stripped when "strip_prefix" is set.
-- MOS_MIGRATED_REVID=134005484
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
index c8d1f3c2c4..73a9a5119f 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
@@ -1010,19 +1010,19 @@ public class FileSystemUtils {
*/
public static void createHardLink(Path linkPath, Path originalPath) throws IOException {
- // Regular file
- if (originalPath.isFile()) {
+ // Directory
+ if (originalPath.isDirectory()) {
+ for (Path originalSubpath : originalPath.getDirectoryEntries()) {
+ Path linkSubpath = linkPath.getRelative(originalSubpath.relativeTo(originalPath));
+ createHardLink(linkSubpath, originalSubpath);
+ }
+ // Other types of file
+ } else {
Path parentDir = linkPath.getParentDirectory();
if (!parentDir.exists()) {
FileSystemUtils.createDirectoryAndParents(parentDir);
}
originalPath.createHardLink(linkPath);
- // Directory
- } else if (originalPath.isDirectory()) {
- for (Path originalSubpath : originalPath.getDirectoryEntries()) {
- Path linkSubpath = linkPath.getRelative(originalSubpath.relativeTo(originalPath));
- createHardLink(linkSubpath, originalSubpath);
- }
}
}
}