Fixed: [Issue 119] Path separator usage in regex pattern on windows
causes uncaught exception during build.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/OutputDirectories.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/OutputDirectories.java
index 7de5121..08ca941 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/OutputDirectories.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/OutputDirectories.java
@@ -8,6 +8,7 @@
*/
package com.google.eclipse.protobuf.ui.builder;
+import static com.google.eclipse.protobuf.ui.util.Paths.segmentsOf;
import static java.io.File.separator;
import java.util.*;
@@ -42,10 +43,9 @@
}
private static IFolder findOrCreateOutputDirectory(IProject project, String outputFolderName) throws CoreException {
- String[] segments = outputFolderName.split(separator);
IFolder outputFolder = null;
StringBuilder path = new StringBuilder();
- for (String segment : segments) {
+ for (String segment : segmentsOf(outputFolderName)) {
path.append(segment);
outputFolder = project.getFolder(path.toString());
if (!outputFolder.exists()) outputFolder.create(true, true, NO_MONITOR);
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Paths.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Paths.java
index 31a545f..30ade64 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Paths.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Paths.java
@@ -25,8 +25,8 @@
*/
public static String[] segmentsOf(String path) {
if (path == null) throw new NullPointerException("The given path should not be null");
- return path.split(separator);
+ return path.split("\\Q" + separator + "\\E");
}
-
+
private Paths() {}
}