feat: 增加sn管理接口
This commit is contained in:
46
src/main/java/com/youlai/boot/common/config/FilePath.java
Normal file
46
src/main/java/com/youlai/boot/common/config/FilePath.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.youlai.boot.common.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class FilePath {
|
||||
// @Value("${file.upload-dir-unix}")
|
||||
private static final String unixUploadDir = "/data/uploads" ;
|
||||
|
||||
// @Value("${file.upload-dir-windows}")
|
||||
private static final String windowsUploadDir = "uploadFile";
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(FilePath.class);
|
||||
|
||||
|
||||
public static final String TABLET_PATH = "tablet";
|
||||
public static final String AVATAR_PATH = "avatar";
|
||||
public static final String APK_ICON_PATH = "apkIcon";
|
||||
public static final String SCREENSHOT_PATH = "screenshot";
|
||||
|
||||
public static String getRootPath() {
|
||||
String osName = System.getProperty("os.name");
|
||||
logger.info("osName: {}", osName);
|
||||
if (osName.contains("Windows")) {
|
||||
String projectPath = System.getProperty("user.dir");
|
||||
logger.info("projectPath: {}", projectPath);
|
||||
return projectPath + File.separator + windowsUploadDir;
|
||||
} else {
|
||||
return unixUploadDir;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAvatarPath() {
|
||||
return getRootPath() + File.separator + TABLET_PATH + File.separator + AVATAR_PATH + File.separator;
|
||||
}
|
||||
|
||||
public static String getApkIconPath() {
|
||||
return getRootPath() + File.separator + TABLET_PATH + File.separator + APK_ICON_PATH + File.separator;
|
||||
}
|
||||
|
||||
public static String getScreenshotPath() {
|
||||
return getRootPath() + File.separator + TABLET_PATH + File.separator + SCREENSHOT_PATH + File.separator;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user