mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Fix windows build log4j2 config inclusion
This commit is contained in:
@@ -1 +1 @@
|
||||
java -Dlog4j.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"
|
||||
java -Dlog4j2.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"
|
||||
@@ -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<Path> paths = Files.walk(Paths.get("/mnt/media/Anime"), 2)) {
|
||||
List<File> result = paths.map(Path::toFile)
|
||||
.filter(File::isDirectory)
|
||||
.collect(Collectors.toList());
|
||||
System.out.println(result);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<File> getDirectoriesAtDepth(String path, int depth) {
|
||||
List<File> 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<File> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user