Skip to content

Commit 49162d6

Browse files
committed
ModuleSearchResult: lean on getLocation() method
Some ModuleInfo subclasses (e.g. the LegacyCommandInfo) override this method to be smarter. Let's take advantage of those efforts.
1 parent f78b9c7 commit 49162d6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/main/java/org/scijava/search/module/ModuleSearchResult.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
package org.scijava.search.module;
3131

32-
import java.io.File;
33-
import java.net.URL;
3432
import java.util.LinkedHashMap;
3533
import java.util.Map;
3634

@@ -39,8 +37,6 @@
3937
import org.scijava.input.Accelerator;
4038
import org.scijava.module.ModuleInfo;
4139
import org.scijava.search.SearchResult;
42-
import org.scijava.util.ClassUtils;
43-
import org.scijava.util.FileUtils;
4440

4541
/**
4642
* Search result for the {@link ModuleSearcher}.
@@ -107,12 +103,8 @@ public Map<String, String> properties() {
107103
// -- Helper methods --
108104

109105
private String getLocation() {
110-
final URL location = ClassUtils.getLocation(info.getDelegateClassName());
111-
final File file = FileUtils.urlToFile(location);
112-
if (file == null) return null;
113-
final String path = file.getAbsolutePath();
114-
if (path == null) return null;
115-
if (path.startsWith(baseDir)) {
106+
final String path = info.getLocation();
107+
if (path != null && baseDir != null && path.startsWith(baseDir)) {
116108
if (path.length() == baseDir.length()) return "";
117109
return path.substring(baseDir.length() + 1);
118110
}

0 commit comments

Comments
 (0)