From 1ada87cd03068effea648b735f083689b3dda836 Mon Sep 17 00:00:00 2001 From: Tomas Timinskas Date: Mon, 22 Jan 2024 11:02:03 -0300 Subject: [PATCH] Last fixes for webview and SB implementation --- .gitignore | 3 ++- desktop/src/jvmMain/kotlin/Main.kt | 17 ++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 2dfe9df..170ebd1 100644 --- a/.gitignore +++ b/.gitignore @@ -60,5 +60,6 @@ desktop/sphinx.db-journal dev.db *.hprof -/desktop/jcef-bundle /desktop/cache +/desktop/kcef-bundle +/desktop/jcef-bundle diff --git a/desktop/src/jvmMain/kotlin/Main.kt b/desktop/src/jvmMain/kotlin/Main.kt index fbbb304..d288b74 100644 --- a/desktop/src/jvmMain/kotlin/Main.kt +++ b/desktop/src/jvmMain/kotlin/Main.kt @@ -24,6 +24,8 @@ import chat.sphinx.platform.imageResource import chat.sphinx.utils.getPreferredWindowSize import com.example.compose.AppTheme import dev.datlag.kcef.KCEF +import dev.datlag.tooling.Tooling +import dev.datlag.tooling.getApplicationWriteableRootFolder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.withContext @@ -137,7 +139,7 @@ fun main() = application { var error by remember { mutableStateOf("") } var downloading by remember { mutableStateOf(0F) } var initialized by remember { mutableStateOf(false) } // if true, KCEF can be used to create clients, browsers etc - val isDebug = true + val isDebug = false LaunchedEffect(Unit) { withContext(Dispatchers.IO) { // IO scope recommended but not required @@ -145,7 +147,7 @@ fun main() = application { val kcefInstallDir = if (isDebug) { File("kcef-bundle") } else { - val rootFolder = AppIO.getWriteableExecutableFolder() + val rootFolder = Tooling.getApplicationWriteableRootFolder("Sphinx") ?: File("./") File(rootFolder, "kcef-bundle") } @@ -173,17 +175,6 @@ fun main() = application { } } -// if (restartRequired) { -// toast("Restart Required") -// } else if (error.isNotEmpty()) { -// toast(error) -// println("ERROR KCEF $error") -// } else { -// if (!initialized) { -//// toast("Downloading $downloading%") -// } -// } - DisposableEffect(Unit) { onDispose { KCEF.disposeBlocking()