mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 18:05:51 -04:00
don't use File::slashpath, fix some date formatting
This commit is contained in:
parent
841fd3c77e
commit
39717c3144
@ -29,6 +29,7 @@ import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
|||||||
import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
||||||
import de.bixilon.minosoft.terminal.RunConfiguration
|
import de.bixilon.minosoft.terminal.RunConfiguration
|
||||||
import de.bixilon.minosoft.util.KUtil.div
|
import de.bixilon.minosoft.util.KUtil.div
|
||||||
|
import de.bixilon.minosoft.util.KUtil.format1
|
||||||
import de.bixilon.minosoft.util.crash.CrashReportUtil
|
import de.bixilon.minosoft.util.crash.CrashReportUtil
|
||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
@ -43,9 +44,12 @@ import javafx.scene.text.TextFlow
|
|||||||
import javafx.stage.Modality
|
import javafx.stage.Modality
|
||||||
import javafx.stage.Stage
|
import javafx.stage.Stage
|
||||||
import javafx.stage.Window
|
import javafx.stage.Window
|
||||||
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import kotlin.time.Clock
|
||||||
|
import kotlin.time.ExperimentalTime
|
||||||
|
|
||||||
|
|
||||||
class ErosCrashReport : JavaFXWindowController() {
|
class ErosCrashReport : JavaFXWindowController() {
|
||||||
@ -54,13 +58,13 @@ class ErosCrashReport : JavaFXWindowController() {
|
|||||||
@FXML private lateinit var detailsFX: TextArea
|
@FXML private lateinit var detailsFX: TextArea
|
||||||
|
|
||||||
|
|
||||||
var crashReportPath: String? = null
|
var crashReportPath: File? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
JavaFXUtil.runLater {
|
JavaFXUtil.runLater {
|
||||||
crashReportPathDescriptionFX.isVisible = value != null
|
crashReportPathDescriptionFX.isVisible = value != null
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
crashReportPathFX.text = value
|
crashReportPathFX.text = value.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,6 +85,7 @@ class ErosCrashReport : JavaFXWindowController() {
|
|||||||
UnsafeUtil.hardCrash()
|
UnsafeUtil.hardCrash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
companion object {
|
companion object {
|
||||||
var alreadyCrashed = false
|
var alreadyCrashed = false
|
||||||
private set
|
private set
|
||||||
@ -116,12 +121,12 @@ class ErosCrashReport : JavaFXWindowController() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
var crashReportPath: String?
|
var crashReportPath: File?
|
||||||
try {
|
try {
|
||||||
val crashReportFolder = (RunConfiguration.HOME_DIRECTORY / "crash-reports").toFile()
|
val crashReportFolder = (RunConfiguration.HOME_DIRECTORY / "crash-reports").toFile()
|
||||||
crashReportFolder.mkdirs()
|
crashReportFolder.mkdirs()
|
||||||
|
|
||||||
crashReportPath = "${crashReportFolder.slashPath}/crash-${SimpleDateFormat("yyyy-MM-dd-HH.mm.ss").format(System.currentTimeMillis())}.txt"
|
crashReportPath = crashReportFolder / "crash-${SimpleDateFormat("yyyy-MM-dd-HH.mm.ss").format1(Clock.System.now())}.txt"
|
||||||
|
|
||||||
val stream = FileOutputStream(crashReportPath)
|
val stream = FileOutputStream(crashReportPath)
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class ScreenshotTaker(
|
|||||||
component += TextComponent(file.name).apply {
|
component += TextComponent(file.name).apply {
|
||||||
color = ChatColors.WHITE
|
color = ChatColors.WHITE
|
||||||
underline()
|
underline()
|
||||||
clickEvent = OpenFileClickEvent(file.slashPath)
|
clickEvent = OpenFileClickEvent(file)
|
||||||
hoverEvent = TextHoverEvent("Click to open")
|
hoverEvent = TextHoverEvent("Click to open")
|
||||||
}
|
}
|
||||||
component += " "
|
component += " "
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.util.crash.freeze
|
package de.bixilon.minosoft.util.crash.freeze
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class FreezeDump(
|
class FreezeDump(
|
||||||
val dump: String,
|
val dump: String,
|
||||||
val path: String?,
|
val path: File?,
|
||||||
)
|
)
|
||||||
|
@ -26,10 +26,16 @@ import de.bixilon.kutil.time.TimeUtil
|
|||||||
import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
||||||
import de.bixilon.minosoft.terminal.RunConfiguration
|
import de.bixilon.minosoft.terminal.RunConfiguration
|
||||||
import de.bixilon.minosoft.util.KUtil.div
|
import de.bixilon.minosoft.util.KUtil.div
|
||||||
|
import de.bixilon.minosoft.util.KUtil.format1
|
||||||
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.lang.management.ManagementFactory
|
import java.lang.management.ManagementFactory
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.nio.file.Path
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import kotlin.time.Clock
|
||||||
|
import kotlin.time.ExperimentalTime
|
||||||
|
import kotlin.time.Instant
|
||||||
|
|
||||||
|
|
||||||
object FreezeDumpUtil {
|
object FreezeDumpUtil {
|
||||||
@ -41,6 +47,7 @@ object FreezeDumpUtil {
|
|||||||
thread.start()
|
thread.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
fun catch(callback: (FreezeDump) -> Unit) {
|
fun catch(callback: (FreezeDump) -> Unit) {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
|
|
||||||
@ -81,12 +88,12 @@ object FreezeDumpUtil {
|
|||||||
val dump = builder.toString()
|
val dump = builder.toString()
|
||||||
|
|
||||||
|
|
||||||
var path: String?
|
var path: File?
|
||||||
try {
|
try {
|
||||||
val crashReportFolder = (RunConfiguration.HOME_DIRECTORY / "dumps" / "freeze").toFile()
|
val crashReportFolder = (RunConfiguration.HOME_DIRECTORY / "dumps" / "freeze").toFile()
|
||||||
crashReportFolder.mkdirs()
|
crashReportFolder.mkdirs()
|
||||||
|
|
||||||
path = "${crashReportFolder.slashPath}/freeze-${SimpleDateFormat("yyyy-MM-dd-HH.mm.ss").format(TimeUtil.now())}.txt"
|
path = crashReportFolder / "freeze-${SimpleDateFormat("yyyy-MM-dd-HH.mm.ss").format1(Clock.System.now())}.txt"
|
||||||
|
|
||||||
val stream = FileOutputStream(path)
|
val stream = FileOutputStream(path)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user