From 9f9e16bc9b4caecf741339a0699d784558fbc738 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 21 十一月 2023 19:15:31 +0800
Subject: [PATCH] 2023年11月21日19:15:18

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java |   50 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
index b0b7b8f..10569f4 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
@@ -25,7 +25,7 @@
     private static volatile HdlFileLogic sHdlFileLogic;
 
     /**
-     * 琛ㄧず1m鏁版嵁
+     * 琛ㄧず1m澶у皬鏁版嵁
      */
     private final int m = 1;
 
@@ -61,35 +61,62 @@
      * 鑾峰彇鎵嬫満鍐呴儴瀛樺偍鏂囦欢璺緞
      */
     public String getAPPInternalStoreFilesPath() {
-        return HDLApp.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getPath();
+        return Objects.requireNonNull(HDLApp.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)).getPath();
     }
 
     /**
-     * 鑾峰彇瀛樻斁銆愮敤鎴枫�戞枃浠跺す鏍硅矾寰�
+     * 鑾峰彇瀛樻斁銆愮敤鎴锋枃浠跺す銆戞牴璺緞
      */
     public String getCurrentUserRootPath() {
         return getAPPInternalStoreFilesPath() + "/" + getUserId();
     }
 
     /**
-     * 鑾峰彇瀛樻斁銆愪綇瀹呫�戞枃浠跺す鏍硅矾寰�
+     * 鑾峰彇瀛樻斁銆愪綇瀹呮枃浠跺す銆戞牴璺緞
      */
     public String getCurrentHomeRootPath() {
         return getCurrentUserRootPath() + "/" + "home_" + getHomeId();
     }
 
     /**
-     * 鑾峰彇銆愭棩蹇椼�戞枃浠跺叏璺緞
+     * 鑾峰彇瀛樻斁銆愰┍鍔ㄦ枃浠跺す銆戞牴璺緞
      */
-    public String getLogFilePath() {
-        return getCurrentHomeRootPath() + "/Log.txt";
+    public String getDriveRootPath() {
+        return getAPPInternalStoreFilesPath() + "/upgrade/drive";
+    }
+
+
+    /**
+     * 鑾峰彇瀛樻斁銆愬浐浠舵枃浠跺す銆戞牴璺緞
+     */
+    public String getFirmwareRootPath() {
+        return getAPPInternalStoreFilesPath() + "/upgrade/firmware";
     }
 
     /**
-     * 鑾峰彇銆愮敤鎴枫�戞枃浠跺叏璺緞
+     * 鑾峰彇銆愭棩蹇楁枃浠躲�戝叏璺緞
+     */
+    public String getLogFilePath() {
+        return getCurrentHomeRootPath() + "/log.txt";
+    }
+
+    /**
+     * 鑾峰彇銆愮敤鎴锋枃浠躲�戝叏璺緞
      */
     public String getUserFilePath() {
-        return getAPPInternalStoreFilesPath() + "/UserConfigManage.txt";
+        return getAPPInternalStoreFilesPath() + "/userConfigManage.txt";
+    }
+
+    /**
+     * 鑾峰彇椹卞姩鍗囩骇鏂囦欢鍏ㄨ矾寰�
+     *
+     * @param driverCode 椹卞姩缂栫爜
+     * @param version    椹卞姩鐗堟湰
+     * @return 鍏ㄨ矾寰�
+     */
+    public String getDrivePathFileName(String driverCode, String version) {
+        String driverFileName = driverCode + "_" + version  + ".zip";
+        return HdlFileLogic.getInstance().getDriveRootPath() + "/" + driverFileName;
     }
 
     //endregion
@@ -102,6 +129,11 @@
     public void createDirectory() {
         //瀛樻斁浣忓畢淇℃伅
         this.createFileDir(this.getCurrentHomeRootPath());
+        //椹卞姩鏂囦欢
+        this.createFileDir(this.getDriveRootPath());
+        //鍥轰欢鏂囦欢
+        this.createFileDir(this.getFirmwareRootPath());
+
     }
 
     /**

--
Gitblit v1.8.0