langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java Tue Nov 18 15:25:18 2014 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java Wed Dec 03 14:25:46 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,13 @@
package com.sun.tools.javac.file;
import java.io.File;
+import java.nio.file.FileSystems;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+
import javax.tools.JavaFileObject;
/**
@@ -58,6 +63,16 @@
return new File(directory, path.replace('/', File.separatorChar));
}
+ public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException {
+ if (directory == null) {
+ String sep = FileSystems.getDefault().getSeparator();
+ return Paths.get(path.replace("/", sep));
+ } else {
+ String sep = directory.getFileSystem().getSeparator();
+ return directory.resolve(path.replace("/", sep));
+ }
+ }
+
public int compareTo(RelativePath other) {
return path.compareTo(other.path);
}