Skip to content

Commit

Permalink
🔀 Merge pull request #23 from vinceglb/19-win-bug-file-extension-filt…
Browse files Browse the repository at this point in the history
…ers-persist-across-invocations

🐛 Fix file extension filters persist across invocations on Windows
  • Loading branch information
vinceglb authored May 15, 2024
2 parents 4a5efc9 + d47a9bb commit 1f2e65a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import io.github.vinceglb.picker.core.platform.windows.api.JnaFileChooser
import java.io.File

internal class WindowsFilePicker : PlatformFilePicker {
private val fileChooser = JnaFileChooser()

override suspend fun pickFile(
initialDirectory: String?,
fileExtensions: List<String>?,
title: String?
): File? {
val fileChooser = JnaFileChooser()

// Setup file chooser
fileChooser.apply {
// Set mode
Expand All @@ -36,6 +36,8 @@ internal class WindowsFilePicker : PlatformFilePicker {
fileExtensions: List<String>?,
title: String?
): List<File>? {
val fileChooser = JnaFileChooser()

// Setup file chooser
fileChooser.apply {
// Set mode
Expand All @@ -58,6 +60,8 @@ internal class WindowsFilePicker : PlatformFilePicker {
}

override fun pickDirectory(initialDirectory: String?, title: String?): File? {
val fileChooser = JnaFileChooser()

// Setup file chooser
fileChooser.apply {
// Set mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import javax.swing.filechooser.FileNameExtensionFilter
*
* @see JFileChooser, WindowsFileChooser, WindowsFileBrowser
*/
internal class JnaFileChooser
() {
internal class JnaFileChooser() {
private enum class Action {
Open, Save
}
Expand Down

0 comments on commit 1f2e65a

Please sign in to comment.