✨ windows 使用脚本执行命令.
This commit is contained in:
@@ -19,25 +19,34 @@ public class PathUtils {
|
||||
/**
|
||||
* 获取用户根目录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param isWindows isWindows
|
||||
* @param username 用户名
|
||||
* @return 用户目录
|
||||
*/
|
||||
public static String getHomePath(String username) {
|
||||
if (Const.ROOT.equals(username)) {
|
||||
return "/" + Const.ROOT;
|
||||
public static String getHomePath(boolean isWindows, String username) {
|
||||
if (isWindows) {
|
||||
// windows
|
||||
return "C:/Users/" + username;
|
||||
} else {
|
||||
return "/home/" + username;
|
||||
// linux
|
||||
if (Const.ROOT.equals(username)) {
|
||||
return "/" + Const.ROOT;
|
||||
} else {
|
||||
return "/home/" + username;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用路径
|
||||
*
|
||||
* @param username username
|
||||
* @param isWindows isWindows
|
||||
* @param username username
|
||||
* @return path
|
||||
*/
|
||||
public static String getAppPath(String username) {
|
||||
return getHomePath(username)
|
||||
public static String getAppPath(boolean isWindows, String username) {
|
||||
return getHomePath(isWindows, username)
|
||||
+ "/" + AppConst.ORION
|
||||
+ "/" + AppConst.ORION_OPS_PRO;
|
||||
}
|
||||
@@ -45,12 +54,13 @@ public class PathUtils {
|
||||
/**
|
||||
* 构建应用路径
|
||||
*
|
||||
* @param username username
|
||||
* @param paths paths
|
||||
* @param isWindows isWindows,
|
||||
* @param username username
|
||||
* @param paths paths
|
||||
* @return path
|
||||
*/
|
||||
public static String buildAppPath(String username, Object... paths) {
|
||||
StringBuilder path = new StringBuilder(getAppPath(username));
|
||||
public static String buildAppPath(boolean isWindows, String username, Object... paths) {
|
||||
StringBuilder path = new StringBuilder(getAppPath(isWindows, username));
|
||||
for (Object o : paths) {
|
||||
path.append("/").append(Objects1.toString(o));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user