diff --git a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt index 7d36c2d547..aaeaf9c910 100644 --- a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt +++ b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/RenderExceptionsHandler.kt @@ -12,7 +12,7 @@ internal class RenderExceptionsHandler { fun throwException(message: String) { if (output == null) { output = File( - "${SkikoProperties.dataPath}/skiko-render-exception-${ProcessHandle.current().pid()}.log" + "${SkikoProperties.logPath}/skiko-render-exception-${ProcessHandle.current().pid()}.log" ) } val exception = RenderException(message) diff --git a/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt b/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt index 347b69f21d..bf0450405c 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 /**