Skip to content

Commit

Permalink
File filters have extra ; and missing \0 (windows) (#113)
Browse files Browse the repository at this point in the history
Co-authored-by: Nuno Cruces <[email protected]>
  • Loading branch information
hfmrow and ncruces authored Aug 14, 2024
1 parent ee06172 commit 848f6d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions file_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func fileOpenDialog(opts options, multi bool) (string, []string, bool, error) {
}

var lst []string
for i := uint32(0); i < count && err == nil; i++ {
for i := uint32(0); i < count; i++ {
str, err := shellItemPath(items.GetItemAt(i))
if err != nil {
return "", nil, true, err
Expand Down Expand Up @@ -499,7 +499,7 @@ func initFilters(filters FileFilters) *uint16 {
res = append(res, syscall.StringToUTF16(p)...)
res[len(res)-1] = ';'
}
res = append(res, 0)
res[len(res)-1] = 0
}
if res != nil {
res = append(res, 0)
Expand All @@ -521,6 +521,7 @@ func initFileTypes(filters FileFilters) (int, *win.COMDLG_FILTERSPEC) {
spec = append(spec, syscall.StringToUTF16(p)...)
spec[len(spec)-1] = ';'
}
spec[len(spec)-1] = 0
res = append(res, win.COMDLG_FILTERSPEC{
Name: syscall.StringToUTF16Ptr(f.Name),
Spec: &spec[0],
Expand Down

0 comments on commit 848f6d0

Please sign in to comment.