Skip to content

Commit

Permalink
fix sorting of game log files
Browse files Browse the repository at this point in the history
  • Loading branch information
Axle1975 committed Jan 15, 2021
1 parent b0606b1 commit 2273011
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ public Path getNewGameLogFile(int gameUID) {
try (Stream<Path> listOfLogFiles = Files.list(getFafLogDirectory())) {
listOfLogFiles
.filter(p -> GAME_LOG_PATTERN.matcher(p.getFileName().toString()).matches())
.sorted(Comparator.comparingLong(p -> p.toFile().lastModified()))
.sorted(Collections.reverseOrder())
.sorted(Comparator.comparingLong(p -> -p.toFile().lastModified()))
.skip(NUMBER_GAME_LOGS_STORED - 1)
.forEach(p -> noCatch(() -> Files.delete(p)));
} catch (IOException e) {
Expand Down

0 comments on commit 2273011

Please sign in to comment.