diff --git a/dialog/file_xdg.go b/dialog/file_xdg.go index 75c3769cbe..1574853825 100644 --- a/dialog/file_xdg.go +++ b/dialog/file_xdg.go @@ -78,13 +78,16 @@ func getFavoriteLocations() (map[string]fyne.ListableURI, error) { func fileOpenOSOverride(d *FileDialog) bool { go func() { - folderCallback, folder := d.callback.(func(fyne.ListableURI, error)) options := &filechooser.OpenOptions{ Modal: true, Directory: folder, AcceptLabel: d.confirmText, } + if d.startingLocation != nil { + options.Location = d.startingLocation.Path() + } + folderCallback, folder := d.callback.(func(fyne.ListableURI, error)) if folder { uris, err := filechooser.OpenFile("", "Open Folder", options) if err != nil { @@ -131,14 +134,17 @@ func fileOpenOSOverride(d *FileDialog) bool { func fileSaveOSOverride(d *FileDialog) bool { go func() { + options := &filechooser.SaveSingleOptions{ + Modal: true, + AcceptLabel: d.confirmText, + FileName: d.initialFileName, + } + if d.startingLocation != nil { + options.Location = d.startingLocation.Path() + } + callback := d.callback.(func(fyne.URIWriteCloser, error)) - uris, err := filechooser.SaveFile("", "Open File", - &filechooser.SaveSingleOptions{ - Modal: true, - AcceptLabel: d.confirmText, - FileName: d.initialFileName, - }, - ) + uris, err := filechooser.SaveFile("", "Open File", options) if err != nil { callback(nil, err) return diff --git a/go.mod b/go.mod index 9be0ea0cd5..94b41b2ea5 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/lucor/goinfo v0.9.0 github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 - github.com/rymdport/portal v0.0.0-20231119194321-d452ead565fd + github.com/rymdport/portal v0.0.0-20231119195719-fb11153c815d github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index d2fb98864b..42112a91df 100644 --- a/go.sum +++ b/go.sum @@ -268,6 +268,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/rymdport/portal v0.0.0-20231119194321-d452ead565fd h1:nHVuLKAtBcunYBBiuclbtYllz+gW9TB3uHR8e1uMoM0= github.com/rymdport/portal v0.0.0-20231119194321-d452ead565fd/go.mod h1:RYYAnv4sssTQ7ceErKl7UD8auER/0yFV7CgmfS/uAD8= +github.com/rymdport/portal v0.0.0-20231119195719-fb11153c815d h1:q+VIAL+ZpA2fP/9k6dn+720s4YJGVATDTj35L2CWsIA= +github.com/rymdport/portal v0.0.0-20231119195719-fb11153c815d/go.mod h1:RYYAnv4sssTQ7ceErKl7UD8auER/0yFV7CgmfS/uAD8= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=