summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-19 13:24:53 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-21 23:23:37 +0100
commit58e0543dbf04c7ebba65976af12cde07806f01ed (patch)
tree0ac4a0d1d8b0ceec2d4209042fb9e0567298e406
parentMerge pull request #742 from zx2c4-forks/jd/menugetter (diff)
downloadwireguard-windows-58e0543dbf04c7ebba65976af12cde07806f01ed.tar.xz
wireguard-windows-58e0543dbf04c7ebba65976af12cde07806f01ed.zip
commondialogs: do not chdir after file dialog
Otherwise a user is unable to delete directories, because the process has chdir'd. Probably changes on global state like this from a UI dialog is not what the programmer wants.
-rw-r--r--commondialogs.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/commondialogs.go b/commondialogs.go
index 804716de..df523ce8 100644
--- a/commondialogs.go
+++ b/commondialogs.go
@@ -116,15 +116,15 @@ func (dlg *FileDialog) show(owner Form, fun func(ofn *win.OPENFILENAME) bool, fl
}
func (dlg *FileDialog) ShowOpen(owner Form) (accepted bool, err error) {
- return dlg.show(owner, win.GetOpenFileName, 0)
+ return dlg.show(owner, win.GetOpenFileName, win.OFN_NOCHANGEDIR)
}
func (dlg *FileDialog) ShowOpenMultiple(owner Form) (accepted bool, err error) {
- return dlg.show(owner, win.GetOpenFileName, win.OFN_ALLOWMULTISELECT|win.OFN_EXPLORER)
+ return dlg.show(owner, win.GetOpenFileName, win.OFN_ALLOWMULTISELECT|win.OFN_EXPLORER|win.OFN_NOCHANGEDIR)
}
func (dlg *FileDialog) ShowSave(owner Form) (accepted bool, err error) {
- return dlg.show(owner, win.GetSaveFileName, 0)
+ return dlg.show(owner, win.GetSaveFileName, win.OFN_NOCHANGEDIR)
}
func pathFromPIDL(pidl uintptr) (string, error) {