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); } }