aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/WindowsFileSystem.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/WindowsFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/WindowsFileSystem.java
index 308e0dfc66..7a144f5c3e 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/WindowsFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/WindowsFileSystem.java
@@ -335,7 +335,12 @@ public class WindowsFileSystem extends JavaIoFileSystem {
if (targetFile.isDirectory()) {
createDirectoryJunction(targetFile, file);
} else {
- Files.copy(targetFile.toPath(), file.toPath());
+ if (targetFile.isAbsolute()) {
+ Files.copy(targetFile.toPath(), file.toPath());
+ } else {
+ // When targetFile is a relative path to linkPath, resolve it to an absolute path first.
+ Files.copy(file.toPath().getParent().resolve(targetFile.toPath()), file.toPath());
+ }
}
} catch (java.nio.file.FileAlreadyExistsException e) {
throw new IOException(linkPath + ERR_FILE_EXISTS);