Skip to content

Commit

Permalink
[windows] Fix directory select in Open Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Apr 6, 2024
1 parent e91c30f commit cf130a6
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions v3/pkg/application/dialogs_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (m *windowOpenFileDialog) show() (chan string, error) {
}

var result []string
if m.dialog.allowsMultipleSelection {
if m.dialog.allowsMultipleSelection && !m.dialog.canChooseDirectories {
temp, err := showCfdDialog(
func() (cfd.Dialog, error) {
return cfd.NewOpenMultipleFilesDialog(config)
Expand All @@ -123,14 +123,25 @@ func (m *windowOpenFileDialog) show() (chan string, error) {
}
result = temp.([]string)
} else {
temp, err := showCfdDialog(
func() (cfd.Dialog, error) {
return cfd.NewOpenFileDialog(config)
}, false)
if err != nil {
return nil, err
if m.dialog.canChooseDirectories {
temp, err := showCfdDialog(
func() (cfd.Dialog, error) {
return cfd.NewSelectFolderDialog(config)
}, false)
if err != nil {
return nil, err
}
result = []string{temp.(string)}
} else {
temp, err := showCfdDialog(
func() (cfd.Dialog, error) {
return cfd.NewOpenFileDialog(config)
}, false)
if err != nil {
return nil, err
}
result = []string{temp.(string)}
}
result = []string{temp.(string)}
}

files := make(chan string)
Expand Down Expand Up @@ -202,6 +213,7 @@ func calculateMessageDialogFlags(options MessageDialogOptions) uint32 {
}
case WarningDialogType:
flags = windows.MB_OK | windows.MB_ICONWARNING
case OpenDirectoryDialogType:
}

return flags
Expand Down

0 comments on commit cf130a6

Please sign in to comment.