From b40ba22ef4352c6a6b197c3fbae1c6dc80bb6117 Mon Sep 17 00:00:00 2001 From: dlaren Date: Fri, 15 Aug 2025 13:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=88=9B=E5=BB=BA=E9=9A=90=E8=97=8F=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=96=87=E4=BB=B6=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=AC=AC=E4=BA=8C=E6=AC=A1=E6=97=A0=E6=B3=95=E5=86=99?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/exam/exam/utils/c/LogFileUtils.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/main/java/com/example/exam/exam/utils/c/LogFileUtils.java b/src/main/java/com/example/exam/exam/utils/c/LogFileUtils.java index 603a954..ac322a3 100644 --- a/src/main/java/com/example/exam/exam/utils/c/LogFileUtils.java +++ b/src/main/java/com/example/exam/exam/utils/c/LogFileUtils.java @@ -53,24 +53,13 @@ public class LogFileUtils { file.getParentFile().mkdirs(); } - // 对于Unix系统,直接在文件名前加"." - if (!System.getProperty("os.name").toLowerCase().contains("win")) { - String hiddenPath = file.getParent() + File.separator + "." + file.getName(); - file = new File(hiddenPath); - } - // 创建文件(如果不存在) if (!file.exists()) { file.createNewFile(); } - // 对于Windows系统,设置隐藏属性 - if (System.getProperty("os.name").toLowerCase().contains("win")) { - Runtime.getRuntime().exec("attrib +H " + file.getCanonicalPath()); - } - } catch (IOException e) { - throw new RuntimeException("无法创建隐藏文件: " + e.getMessage(), e); + throw new RuntimeException("无法创建文件: " + e.getMessage(), e); } }