增加file的path读取

This commit is contained in:
mcy
2018-11-02 11:07:41 +08:00
parent 5b9ada1f8c
commit 5cc2f8f9f7

View File

@@ -292,10 +292,13 @@ public class ExtensionLoader<T> {
private String getJarDirectoryPath() {
URL url = Thread.currentThread().getContextClassLoader().getResource("");
if (url == null) {
throw new IllegalStateException("failed to get class loader resource");
String dirtyPath;
if (url != null) {
dirtyPath = url.toString();
} else {
File file = new File("");
dirtyPath = file.getAbsolutePath();
}
String dirtyPath = url.toString();
String jarPath = dirtyPath.replaceAll("^.*file:/", ""); // removes
// file:/ and
// everything