mirror of
https://gitee.com/arthas/arthas.git
synced 2024-12-02 12:17:45 +08:00
polish "support windows unicode file path" #574
This commit is contained in:
parent
4641ec0e6d
commit
afb4c9d3b2
@ -6,7 +6,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.security.CodeSource;
|
import java.security.CodeSource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -339,13 +338,12 @@ public class Bootstrap {
|
|||||||
if (arthasHomeDir == null) {
|
if (arthasHomeDir == null) {
|
||||||
CodeSource codeSource = Bootstrap.class.getProtectionDomain().getCodeSource();
|
CodeSource codeSource = Bootstrap.class.getProtectionDomain().getCodeSource();
|
||||||
if (codeSource != null) {
|
if (codeSource != null) {
|
||||||
String bootJarPath = codeSource.getLocation().getFile();
|
|
||||||
try {
|
try {
|
||||||
//convert unicode path to normal path
|
// https://stackoverflow.com/a/17870390
|
||||||
bootJarPath = URLDecoder.decode(bootJarPath, "utf-8");
|
File bootJarPath = new File(codeSource.getLocation().toURI().getSchemeSpecificPart());
|
||||||
verifyArthasHome(new File(bootJarPath).getParent());
|
verifyArthasHome(bootJarPath.getParent());
|
||||||
arthasHomeDir = new File(bootJarPath).getParentFile();
|
arthasHomeDir = bootJarPath.getParentFile();
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user