aboutsummaryrefslogtreecommitdiffstatshomepage
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-03-19 13:24:53 -0600
commitd35a18df246f1ac8ed8310503bcacf0f97136c14 (patch)
tree764ba02832b3b6399c69e4f90e451ade772995d9
parentdatabinding: disable reflection for better dead code elimination (diff)
downloadwireguard-windows-pkg/walk.tar.xz
wireguard-windows-pkg/walk.zip
commondialogs: do not chdir after file dialogpkg/walk
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 ever 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) {