Skip to content

Commit

Permalink
Save dialog: start in correct initial dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lars committed Oct 21, 2021
1 parent 2981178 commit c3b826e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion v2/file_save_dialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package wui

import (
"os"
"path/filepath"
"strings"
"syscall"

Expand Down Expand Up @@ -116,7 +117,14 @@ func (dlg *FileSaveDialog) getSaveFileName(parent *Window, bufLen int) (bool, []
initDir = &initDir16[0]
}
} else {
path, err := syscall.UTF16FromString(dlg.initPath)
dir, file := filepath.Split(dlg.initPath)

initDir16, err = syscall.UTF16FromString(dir)
if err == nil {
initDir = &initDir16[0]
}

path, err := syscall.UTF16FromString(file)
if err == nil {
copy(filenameBuf, path)
}
Expand Down

0 comments on commit c3b826e

Please sign in to comment.