mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
增加file的path读取
This commit is contained in:
@@ -292,10 +292,13 @@ public class ExtensionLoader<T> {
|
|||||||
|
|
||||||
private String getJarDirectoryPath() {
|
private String getJarDirectoryPath() {
|
||||||
URL url = Thread.currentThread().getContextClassLoader().getResource("");
|
URL url = Thread.currentThread().getContextClassLoader().getResource("");
|
||||||
if (url == null) {
|
String dirtyPath;
|
||||||
throw new IllegalStateException("failed to get class loader resource");
|
if (url != null) {
|
||||||
|
dirtyPath = url.toString();
|
||||||
|
} else {
|
||||||
|
File file = new File("");
|
||||||
|
dirtyPath = file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
String dirtyPath = url.toString();
|
|
||||||
String jarPath = dirtyPath.replaceAll("^.*file:/", ""); // removes
|
String jarPath = dirtyPath.replaceAll("^.*file:/", ""); // removes
|
||||||
// file:/ and
|
// file:/ and
|
||||||
// everything
|
// everything
|
||||||
|
|||||||
Reference in New Issue
Block a user