Skip to content

Commit 79ebf22

Browse files
committed
EclipseHelper: handle spaces in the directory path
Even if the relative paths in class path cannot have spaces, the directories making up the class path can very well contain spaces somewhere along the lines. By using the FileUtils to convert from a file: URL to a File, we handle spaces and all kinds of funny characters in the directory names at the same time. Pointed out by Christian Dietz. Incidentally, this also fixes *another* problem Christian pointed out: on Windows, the file: URLs cannot be turned into proper paths by stripping the "file:" prefix because the URLs start with a slash to indicate absolute paths, then continue with the DOS style drive letter and a colon because that is what Windows calls an absolute path. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent a71ebdf commit 79ebf22

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/scijava/annotations/EclipseHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import java.util.jar.JarFile;
4343
import java.util.jar.Manifest;
4444

45+
import org.scijava.util.FileUtils;
46+
4547
/**
4648
* Helps Eclipse's lack of support for annotation processing in incremental
4749
* build mode.
@@ -198,7 +200,7 @@ private void maybeIndex(final URL url, final ClassLoader loader) {
198200
}
199201
return;
200202
}
201-
File directory = new File(path);
203+
File directory = FileUtils.urlToFile(url);
202204
if (!directory.isDirectory()) {
203205
return;
204206
}

0 commit comments

Comments
 (0)