|
@@ -1,35 +1,35 @@
|
|
|
-//package cn.com.qmth.print.manage.config;
|
|
|
-//
|
|
|
-//import org.springframework.stereotype.Component;
|
|
|
-//
|
|
|
-//import java.io.File;
|
|
|
-//import java.util.Objects;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @Description:
|
|
|
-// * @Author: CaoZixuan
|
|
|
-// * @Date:
|
|
|
-// */
|
|
|
-//@Component
|
|
|
-//public class SysProperty {
|
|
|
-//
|
|
|
-// private String tempDir = initTempDataDir();
|
|
|
-//
|
|
|
-// public static String initTempDataDir() {
|
|
|
-// ClassLoader classLoader = SysProperty.class.getClassLoader();
|
|
|
-// // 步骤 2:获取当前类的所在路径
|
|
|
-// String path = Objects.requireNonNull(classLoader.getResource("")).getPath();
|
|
|
-// // 步骤 3:定位到项目的根目录
|
|
|
+package cn.com.qmth.print.manage.config;
|
|
|
+
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @Author: CaoZixuan
|
|
|
+ * @Date:
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class SysProperty {
|
|
|
+
|
|
|
+ private String tempDir = initTempDataDir();
|
|
|
+
|
|
|
+ public static String initTempDataDir() {
|
|
|
+ ClassLoader classLoader = SysProperty.class.getClassLoader();
|
|
|
+ // 步骤 2:获取当前类的所在路径
|
|
|
+ String path = Objects.requireNonNull(classLoader.getResource("")).getPath();
|
|
|
+ // 步骤 3:定位到项目的根目录
|
|
|
// String rootPath = path.substring(0, path.indexOf("/target"));
|
|
|
-// // 打印根目录路径
|
|
|
-// return new File(rootPath).getParent() + "/temp";
|
|
|
-// }
|
|
|
-//
|
|
|
-// public String getTempDir() {
|
|
|
-// return tempDir;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public void setTempDir(String tempDir) {
|
|
|
-// this.tempDir = tempDir;
|
|
|
-// }
|
|
|
-//}
|
|
|
+ // 打印根目录路径
|
|
|
+ return new File(path).getParent() + "/temp";
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getTempDir() {
|
|
|
+ return tempDir;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTempDir(String tempDir) {
|
|
|
+ this.tempDir = tempDir;
|
|
|
+ }
|
|
|
+}
|