langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
equal
deleted
inserted
replaced
55 |
55 |
56 public abstract RelativeDirectory dirname(); |
56 public abstract RelativeDirectory dirname(); |
57 |
57 |
58 public abstract String basename(); |
58 public abstract String basename(); |
59 |
59 |
60 public File getFile(File directory) { |
|
61 if (path.length() == 0) |
|
62 return directory; |
|
63 return new File(directory, path.replace('/', File.separatorChar)); |
|
64 } |
|
65 |
|
66 public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException { |
60 public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException { |
67 if (directory == null) { |
61 if (directory == null) { |
68 String sep = FileSystems.getDefault().getSeparator(); |
62 String sep = FileSystems.getDefault().getSeparator(); |
69 return Paths.get(path.replace("/", sep)); |
63 return Paths.get(path.replace("/", sep)); |
70 } else { |
64 } else { |
71 String sep = directory.getFileSystem().getSeparator(); |
65 String sep = directory.getFileSystem().getSeparator(); |
72 return directory.resolve(path.replace("/", sep)); |
66 return directory.resolve(path.replace("/", sep)); |
73 } |
67 } |
74 } |
68 } |
75 |
69 |
|
70 @Override |
76 public int compareTo(RelativePath other) { |
71 public int compareTo(RelativePath other) { |
77 return path.compareTo(other.path); |
72 return path.compareTo(other.path); |
78 } |
73 } |
79 |
74 |
80 @Override |
75 @Override |