From f433dd524ca8781f950278e6687f06cee7acf121 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Mon, 22 Feb 2021 19:04:55 +0000 Subject: [PATCH] Fix #5. --- file_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/file_windows.go b/file_windows.go index db0360d..e6bad4f 100644 --- a/file_windows.go +++ b/file_windows.go @@ -243,7 +243,7 @@ func pickFolders(opts options, multi bool) (str string, lst []string, err error) uintptr(unsafe.Pointer(&item))) if hr >= 0 && item != nil { - dialog.Call(dialog.vtbl.SetDefaultFolder, uintptr(unsafe.Pointer(item))) + dialog.Call(dialog.vtbl.SetFolder, uintptr(unsafe.Pointer(item))) item.Call(item.vtbl.Release) } } @@ -362,12 +362,12 @@ func initDirNameExt(filename string, name []uint16) (dir *uint16, ext *uint16) { d, n := splitDirAndName(filename) e := filepath.Ext(n) if n != "" { - copy(name, syscall.StringToUTF16(n)) + copy(name, syscall.StringToUTF16(filename)) } if d != "" { dir = syscall.StringToUTF16Ptr(d) } - if e != "" { + if len(e) > 1 { ext = syscall.StringToUTF16Ptr(e[1:]) } return