}
public static URI toURI(String localPath) {
+ return toURI(localPath, true);
+ }
+
+ private static URI toURI(String localPath, boolean convertSpaces) {
try {
String p = FileUtil.toSystemIndependentName(localPath);
if (!p.startsWith("/")) {
if (p.startsWith("//")) {
p = "//" + p;
}
- return new URI("file", null, p.replaceAll(" ", "%20"), null);
+ return new URI("file", null, convertSpaces? p.replaceAll(" ", "%20") : p, null);
}
catch (URISyntaxException e) {
throw new Error(e);
}
public static File convertToFile(final URI uri) {
- return new File(toURI(uri.getPath()));
+ return new File(toURI(uri.getPath(), false));
}
}
}
private File findOutputDir(File src) {
- File file = src.getParentFile();
+ File file = FileUtil.getParentFile(src);
while (file != null) {
for (Map.Entry<File, Set<File>> entry : myOutputsMap.entrySet()) {
if (entry.getValue().contains(file)) {