From cc23d8c5bca6ed43f4ab8fe2067ee49402b1f24d Mon Sep 17 00:00:00 2001 From: RatzzFatzz Date: Tue, 16 Dec 2025 22:31:09 +0100 Subject: [PATCH] Fix windows build log4j2 config inclusion --- pom.xml | 4 +- src/deb/bin/mkvaudiosubtitlechanger | 2 +- .../LoadFilesTest.java | 66 ------------------- src/main/resources/log4j2-windows.yaml | 4 +- 4 files changed, 5 insertions(+), 71 deletions(-) delete mode 100644 src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/LoadFilesTest.java diff --git a/pom.xml b/pom.xml index 9e6fdd5..72f7149 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ src/main/resources - log4j2-installed.yaml + log4j2-windows.yaml @@ -130,7 +130,7 @@ false false - -Dlog4j.configurationFile=log4j2-windows.yaml + -Dlog4j2.configurationFile=log4j2-windows.yaml diff --git a/src/deb/bin/mkvaudiosubtitlechanger b/src/deb/bin/mkvaudiosubtitlechanger index 19ea12a..dcc8207 100644 --- a/src/deb/bin/mkvaudiosubtitlechanger +++ b/src/deb/bin/mkvaudiosubtitlechanger @@ -1 +1 @@ -java -Dlog4j.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@" \ No newline at end of file +java -Dlog4j2.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@" \ No newline at end of file diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/LoadFilesTest.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/LoadFilesTest.java deleted file mode 100644 index d2920d9..0000000 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/LoadFilesTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package at.pcgamingfreaks.mkvaudiosubtitlechanger; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class LoadFilesTest { - public static void main(String[] args) { - int depth = 2; - - getDirectoriesAtDepth("/mnt/media/Anime", 2); - - try (Stream paths = Files.walk(Paths.get("/mnt/media/Anime"), 2)) { - List result = paths.map(Path::toFile) - .filter(File::isDirectory) - .collect(Collectors.toList()); - System.out.println(result); - } catch (IOException e) { - } - } - - private static List getDirectoriesAtDepth(String path, int depth) { - List result = new ArrayList<>(); - File rootDir = Path.of(path).toFile(); - if (!rootDir.exists()) throw new RuntimeException("Invalid path"); - - exploreDirectory(rootDir, 0, depth, result); - return result; - } - - /** - * Recursively explores directories to find items at the target depth. - * - * @param currentDir The current directory being explored - * @param currentDepth The current depth level - * @param targetDepth The target depth to collect files - * @param result The collection to store found files - */ - private static void exploreDirectory(File currentDir, int currentDepth, int targetDepth, List result) { - if (currentDepth == targetDepth) { - // We've reached the target depth, add this directory to results - result.add(currentDir); - return; - } - - // Get all files and directories in the current directory - File[] files = currentDir.listFiles(); - if (files == null) return; - - // Recursively explore subdirectories - for (File file : files) { - if (file.isDirectory()) { - exploreDirectory(file, currentDepth + 1, targetDepth, result); - } else if (currentDepth + 1 == targetDepth) { - // If files at the next level would be at the target depth, include them - result.add(file); - } - } - } -} diff --git a/src/main/resources/log4j2-windows.yaml b/src/main/resources/log4j2-windows.yaml index fc363db..d14055c 100644 --- a/src/main/resources/log4j2-windows.yaml +++ b/src/main/resources/log4j2-windows.yaml @@ -3,8 +3,8 @@ Configuration: Appenders: RollingFile: name: FileAppender - fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log - filePattern: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz + fileName: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/application.log + filePattern: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz PatternLayout: Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable" ThresholdFilter: