From 0684e9531f7f59372a0f055b7df345e612f50eb0 Mon Sep 17 00:00:00 2001 From: Zachary Wander Date: Sat, 17 Aug 2024 16:55:59 -0400 Subject: [PATCH] Override `saveFile()` in LinuxFilePicker --- .../filekit/core/platform/linux/LinuxFilePicker.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/filekit-core/src/jvmMain/kotlin/io/github/vinceglb/filekit/core/platform/linux/LinuxFilePicker.kt b/filekit-core/src/jvmMain/kotlin/io/github/vinceglb/filekit/core/platform/linux/LinuxFilePicker.kt index b7b641e..57b4d01 100644 --- a/filekit-core/src/jvmMain/kotlin/io/github/vinceglb/filekit/core/platform/linux/LinuxFilePicker.kt +++ b/filekit-core/src/jvmMain/kotlin/io/github/vinceglb/filekit/core/platform/linux/LinuxFilePicker.kt @@ -51,4 +51,14 @@ internal class LinuxFilePicker( title, parentWindow ) else swingFilePicker.pickDirectory(initialDirectory, title, parentWindow) + + override suspend fun saveFile( + bytes: ByteArray?, + baseName: String, + extension: String, + initialDirectory: String?, + parentWindow: Window? + ): File? = if (xdgFilePickerPortalAvailable) xdgFilePickerPortal.saveFile( + bytes, baseName, extension, initialDirectory, parentWindow + ) else awtFilePicker.saveFile(bytes, baseName, extension, initialDirectory, parentWindow) } \ No newline at end of file