diff --git a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt index f14b1ece5..ad1a1606e 100644 --- a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt +++ b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt @@ -18,7 +18,7 @@ internal class RenderExceptionsHandler { try { if (output == null) { output = File( - "${SkikoProperties.dataPath}/skiko-render-exception-${ProcessHandle.current().pid()}.log" + "${SkikoProperties.logPath}/skiko-render-exception-${ProcessHandle.current().pid()}.log" ) output!!.parentFile.mkdirs() } diff --git a/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt b/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt index b6f742b16..636d509b9 100644 --- a/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt +++ b/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt @@ -29,9 +29,7 @@ object SkikoProperties { /** * The path where to store data files. * - * It is used for extracting the Skiko binaries (if `libraryPath` isn't null) and logging. - * - * TODO: Use $XDG_STATE_HOME (Unix) / ~/Library/Logs (macOS) for logging instead? + * It is used for extracting the Skiko binaries (if `libraryPath` isn't null). */ val dataPath: String get() { return getProperty("skiko.data.path") ?: when (hostOs) { @@ -47,6 +45,23 @@ object SkikoProperties { } } + /** + * The path where to store log files. + */ + val logPath: String get() { + return getProperty("skiko.data.path") ?: when (hostOs) { + OS.Windows -> "${getenv("LOCALAPPDATA")}/Skiko" + OS.MacOS, OS.Ios -> "${getProperty("user.home")}/Library/Logs/Skiko" + else -> { + var stateHome = getenv("XDG_STATE_HOME") + if (stateHome == null || !stateHome.startsWith('/')) { + stateHome = "${getProperty("user.home")}/.local/state" + } + return "${stateHome}/skiko" + } + } + } + val vsyncEnabled: Boolean get() = getProperty("skiko.vsync.enabled")?.toBoolean() ?: true /**