修复日志导出 (#2400)

* 优化日志导出

以防万一的操作,防止一些必要的 log 没被打包

* Update LogExporter.java

* 更新 LogExporter.java

* add

* Revert "add"

This reverts commit 287f9300d7.

* add

* 奇怪我什么时候改过这里了?
This commit is contained in:
zkitefly 2023-08-19 08:00:42 +08:00 committed by GitHub
parent c1ffd26c80
commit 05086fa76d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -831,6 +831,10 @@ public final class LauncherHelper {
@Override
public void onExit(int exitCode, ExitType exitType) {
if (showLogs) {
Platform.runLater(() -> logWindow.logLine(String.format("[HMCL ProcessListener] Minecraft exit with code %d.", exitCode), Log4jLevel.INFO));
}
launchingLatch.countDown();
if (exitType == ExitType.INTERRUPTED)

View File

@ -92,7 +92,7 @@ public final class LogExporter {
for (Path file : stream) {
if (Files.isRegularFile(file)) {
FileTime time = Files.readAttributes(file, BasicFileAttributes.class).creationTime();
FileTime time = Files.readAttributes(file, BasicFileAttributes.class).lastModifiedTime();
if (time.toMillis() >= processStartTime) {
String crashLog = Logging.filterForbiddenToken(FileUtils.readText(file));
zipper.putTextFile(crashLog, file.getFileName().toString());