📄 utils.java
字号:
package com.sslexplorer.vpn.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Utils {
/**
* Get the users home directory and if were operating in the MSJVM then
* try to get the users profile, since MSJVM does not return the correct
* location for the user.home system property.
*
* @return String
*/
public static String getHomeDirectory() {
String userHome = System.getProperty("user.home");
if (System.getProperty("java.vendor") != null &&
System.getProperty("java.vendor").startsWith("Microsoft")) {
try {
Process process = Runtime.getRuntime().exec(new String[] {
"cmd.exe",
"/C",
"echo",
"%USERPROFILE%"});
BufferedReader reader = new BufferedReader(new InputStreamReader(process.
getInputStream()));
String profileDir = reader.readLine();
File f = new File(profileDir);
if (f.exists()) {
userHome = profileDir;
}
}
catch (Throwable t) {
// Ignore, we cant do anything about it!!
}
}
return userHome;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -