From ec73287c65a85795a940871bf42656efbf845f64 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 19 十一月 2022 11:00:40 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/helper/PathHelper.java | 36 +++++++++++++++++++++--------------- 1 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/lf/server/helper/PathHelper.java b/src/main/java/com/lf/server/helper/PathHelper.java index 1d98161..c22ca9f 100644 --- a/src/main/java/com/lf/server/helper/PathHelper.java +++ b/src/main/java/com/lf/server/helper/PathHelper.java @@ -112,22 +112,9 @@ file.mkdirs(); } + deleteOldPath(config.getTempPath()); + return path; - } - - /** - * 鑾峰彇涓存椂璺緞鍚嶇О - */ - public String getTempPathName() { - String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); - String path = config.getTempPath() + File.separator + tempName; - - File file = new File(path); - if (!file.exists() && !file.isDirectory()) { - file.mkdirs(); - } - - return tempName; } /** @@ -143,10 +130,29 @@ } } + deleteOldPath(config.getTempPath()); + return getTempPath(); } /** + * 鑾峰彇涓存椂璺緞鍚嶇О + */ + public String getTempPathName() { + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); + String path = config.getTempPath() + File.separator + tempName; + + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + } + + deleteOldPath(config.getTempPath()); + + return tempName; + } + + /** * 鍒犻櫎鏃ц矾寰� */ public void deleteOldPath(String tempPath) { -- Gitblit v1.9.3