⚡ 优化批量上传逻辑.
This commit is contained in:
@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.1.6";
|
||||
String VERSION = "2.1.7";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -21,6 +21,8 @@ public interface ExtraFieldConst extends FieldConst {
|
||||
|
||||
String USERNAME = "username";
|
||||
|
||||
String HOME = "home";
|
||||
|
||||
String STATUS_NAME = "statusName";
|
||||
|
||||
String KEY_NAME = "keyName";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orion.visor.framework.common.utils;
|
||||
|
||||
import com.orion.lang.utils.Objects1;
|
||||
import com.orion.lang.utils.Systems;
|
||||
import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.visor.framework.common.constant.AppConst;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
|
||||
@@ -24,9 +26,25 @@ public class PathUtils {
|
||||
* @return 用户目录
|
||||
*/
|
||||
public static String getHomePath(boolean isWindows, String username) {
|
||||
return getHomePath(isWindows, username, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户根目录
|
||||
*
|
||||
* @param isWindows isWindows
|
||||
* @param username 用户名
|
||||
* @param prependSeparator 是否在头部添加分隔符
|
||||
* @return 用户目录
|
||||
*/
|
||||
public static String getHomePath(boolean isWindows, String username, boolean prependSeparator) {
|
||||
if (isWindows) {
|
||||
// windows
|
||||
return "C:/Users/" + username;
|
||||
if (prependSeparator) {
|
||||
return "/C:/Users/" + username;
|
||||
} else {
|
||||
return "C:/Users/" + username;
|
||||
}
|
||||
} else {
|
||||
// linux
|
||||
if (Const.ROOT.equals(username)) {
|
||||
@@ -66,4 +84,34 @@ public class PathUtils {
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 头部添加分隔符
|
||||
*
|
||||
* @param path path
|
||||
* @return path
|
||||
*/
|
||||
public static String prependSeparator(String path) {
|
||||
if (path.startsWith("/")) {
|
||||
return path;
|
||||
}
|
||||
return "/" + path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 orion path
|
||||
*
|
||||
* @param path path
|
||||
* @return path
|
||||
*/
|
||||
public static String getOrionPath(String path) {
|
||||
path = Systems.HOME_DIR
|
||||
+ Files1.SEPARATOR
|
||||
+ AppConst.ORION
|
||||
+ Files1.SEPARATOR
|
||||
+ AppConst.APP_NAME
|
||||
+ Files1.SEPARATOR
|
||||
+ path;
|
||||
return Files1.getPath(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user