From f8656588595af6cb716341b5daacba26e350a872 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 27 六月 2023 17:42:10 +0800 Subject: [PATCH] 2023年06月27日17:42:08 --- app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 40 insertions(+), 7 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 958fb8b..ee5c470 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java @@ -5,6 +5,7 @@ import android.util.Log; import com.hdl.photovoltaic.HDLApp; +import com.hdl.photovoltaic.config.UserConfigManage; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -14,7 +15,7 @@ import java.io.IOException; /** - * 鏂囦欢鐣岄潰鐨勯�昏緫 + * 鏂囦欢鐨勯�昏緫 */ public class HdlFileLogic { @@ -39,20 +40,42 @@ private static final String TAG = "FileUtils"; - public static final String userId = ""; + private String getUserId() { + return UserConfigManage.getInstance().getUserId(); + } + + private String getHomeId() { + return UserConfigManage.getInstance().getHomeId(); + } /** - * 鑾峰彇鍐呴儴瀛樺偍鏂囦欢璺緞 + * 鑾峰彇鎵嬫満鍐呴儴瀛樺偍鏂囦欢璺緞 */ - private String getInternalStoreFilesPath() { + private String getAPPInternalStoreFilesPath() { return HDLApp.getInstance().getFilesDir().getAbsolutePath(); } /** - * 鑾峰彇App瀛樻斁鏂囦欢鐨勬牴璺緞 + * 鑾峰彇瀛樻斁鏂囦欢鐢ㄦ埛鏍硅矾寰� */ - public String getAppFilesPath() { - return HDLApp.getInstance().getFilesDir().getAbsolutePath() + userId + "/home"; + public String getUserFilesPath() { + return HDLApp.getInstance().getFilesDir().getAbsolutePath() + getUserId(); + } + + /** + * 鑾峰彇瀛樻斁鏂囦欢浣忓畢鏍硅矾寰� + */ + public String getHomeFilesPath() { + return HDLApp.getInstance().getFilesDir().getAbsolutePath() + getUserId() + "/home"; + } + + /** + * 浣忓畢鍚嶇О + * + * @return - + */ + public String getHomeFileName() { + return getHomeId() + ".json"; } public File createFile(String dirPath, String fileName) { @@ -193,4 +216,14 @@ } return null; } + + /** + * 棰勫垱寤烘枃浠跺す + */ + public void createDirectory() { + //鐢ㄦ埛淇℃伅 + this.createFileDir(new File(this.getUserFilesPath())); + //浣忓畢淇℃伅 + this.createFileDir(new File(this.getHomeFilesPath())); + } } -- Gitblit v1.8.0