desktop: open database dir (#3019)

* desktop: open database dir

* alert

* move button

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Stanislav Dmitrenko
2023-09-05 20:24:39 +03:00
committed by GitHub
parent 83b939d215
commit 67d5b6eace
5 changed files with 32 additions and 0 deletions
@@ -2,8 +2,10 @@ package chat.simplex.common.platform
import androidx.compose.runtime.*
import chat.simplex.common.*
import chat.simplex.common.views.helpers.AlertManager
import chat.simplex.common.views.helpers.generalGetString
import chat.simplex.res.MR
import java.awt.Desktop
import java.io.*
import java.net.URI
@@ -19,6 +21,20 @@ actual val agentDatabaseFileName: String = "simplex_v1_agent.db"
actual val databaseExportDir: File = tmpDir
actual fun desktopOpenDatabaseDir() {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().open(dataDir);
} catch (e: IOException) {
Log.e(TAG, e.stackTraceToString())
AlertManager.shared.showAlertMsg(
title = generalGetString(MR.strings.unknown_error),
text = e.stackTraceToString()
)
}
}
}
@Composable
actual fun rememberFileChooserLauncher(getContent: Boolean, rememberedValue: Any?, onResult: (URI?) -> Unit): FileChooserLauncher =
remember(rememberedValue) { FileChooserLauncher(getContent, onResult) }