Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Nov 16, 2024
1 parent 0dbd73b commit 34c8d20
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions megamek/src/megamek/utilities/BoardsTagger.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,17 @@ public static Tags parse(String tag) {

public static void main(String... args) {
try {
Map<String, List<String>> boardCheckSum = new HashMap<>();

File boardDir = Configuration.boardsDir();
scanForBoards(boardDir);
scanForBoards(boardDir, boardCheckSum);

boardCheckSum.forEach((key, value) -> {
if (value.size() > 1) {
String message = key + " : " + value.stream().sorted().collect(Collectors.joining(", "));
logger.info(message);
}
});
} catch (Exception ex) {
logger.error(ex, "Board tagger cannot scan boards");
System.exit(64);
Expand All @@ -133,15 +142,13 @@ public static void main(String... args) {
* Recursively scans the supplied file/directory for any boards and auto-tags
* them.
*/
private static void scanForBoards(File file) throws IOException {
Map<String, List<String>> boardCheckSum = new HashMap<>();

private static void scanForBoards(File file, Map<String, List<String>> boardCheckSum) throws IOException {
if (file.isDirectory()) {
String[] fileList = file.list();
for (String filename : fileList) {
File filepath = new File(file, filename);
if (filepath.isDirectory()) {
scanForBoards(new File(file, filename));
scanForBoards(new File(file, filename), boardCheckSum);
} else {
tagBoard(filepath);
checkSum(boardCheckSum, filepath);
Expand All @@ -151,13 +158,6 @@ private static void scanForBoards(File file) throws IOException {
tagBoard(file);
checkSum(boardCheckSum, file);
}

boardCheckSum.forEach((key, value) -> {
if (value.size() > 1) {
String message = key + " : " + value.stream().sorted().collect(Collectors.joining(", "));
logger.info(message);
}
});
}

/**
Expand Down

0 comments on commit 34c8d20

Please sign in to comment.