Fyne: File Open Dialog Should Support Opening Folders

Created on 5 May 2020  路  20Comments  路  Source: fyne-io/fyne

Is your feature request related to a problem? Please describe:

It is only possible for the user to open a file, it is not possible for the user to open a folder.

Is it possible to construct a solution with the existing API?

No

Describe the solution you'd like to see:

It should be possible to show a dialog for the user to select a folder, either through the existing ShowOpenDialog, or a new ShowOpenFolderDialog.

blocker

All 20 comments

Moving to 1.3 alongside the other file picker work, @andydotxyz if you think this should be 1.3.x feel free to move over

Probably requires some discussion, as I have not figured out how we can do this.
Also I think it would be good to get feedback on the initial file handling code before extending it to the more complex cases.

Agreed, moving to 1.3.x

Idea: this could leverage the proposed file filtering feature, to filter out files and only show directories.

I agree with @stuartmscott that this would be very good to see in an upcoming release in 1.3.x. Having this implemented would make the file picker implementation more or less complete in my opinion.

I think the idea about using the (now implemented as far as I am aware) file filters would be a good idea for this. Looking at the folder selection in Chrome for selecting where downloads should be saved, it looks like they are not showing any files at all and only folders. So in theory (yes it is always harder to do in practice) we could just use the file filtering to turn of showing files and then modify the FileOpen dialog layout to send the callback on the currently viewed folder instead of selecting any files.

chrome-folder-select

Idea: this could leverage the proposed file filtering feature, to filter out files and only show directories.

Your scheme seems feasible, but what type should I filter? The folder has no type, can you give the code that can be run

I think that @stuartmscott was just proposing ways that this could be built internally - even with the right filtering the dialog does not support picking of a folder

This can be done as soon as we have the ListableURI (or equivalent) as that is what the callback will need to return.
For example:

    dialog.ShowFileOpen(func(dir fyne.ListableURI, err error) {
        if err != nil {
            dialog.ShowError(err, win)
            return
        }
        loadDir(dir)
    }, win)

This can be done as soon as we have the ListableURI (or equivalent) as that is what the callback will need to return.
For example:

  dialog.ShowFileOpen(func(dir fyne.ListableURI, err error) {
      if err != nil {
          dialog.ShowError(err, win)
          return
      }
      loadDir(dir)
  }, win)

But not yet fyne.ListableURI

Correct. It is being worked on in PR #1233

That is a function that I really need now. For my application scenario, is necessary that the user select a folder to watch for changes. Is there any work around that a I can make the folder selection work?

There is no workaround, it needs support coded into the file picker, desktop driver and mobile drivers to function correctly.

Will that feature released in the next version? Is there that feature in the road map of the project?

It鈥檚 hard to say at this point. We have it prioritised for 1.4 but a lot of other work has to be crammed in too. And this time we have a hard deadline as Google is making updated Android API support required in 2 weeks time!

Of course we always try to accommodate the needs of our sponsors :) https://github.com/sponsors/fyne-io

I'll sponsor the fyne :) !

THanks @angelopolotto 鉂わ笍

If you want a preview you can now test out this functionality from the PR #1449.
All being well this will be released in a week with 1.4.

Amazing news!!! I'll test that. The 1.4 release will be a great evolution of Fyne, you will need a wine to celebrate. Is all the milestone on github projetcs?

Resolved and ready for testing on develop branch.
This will not completely work on iOS and Android until #1455 is implemented which should be before 1.4 release as well

You can see what else is in 1.4 using the milestone link https://github.com/fyne-io/fyne/milestone/11.

We may not get all the features in but the blockers will be resolved for sure :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boussou picture boussou  路  9Comments

Geo25rey picture Geo25rey  路  7Comments

andydotxyz picture andydotxyz  路  7Comments

develar picture develar  路  6Comments

jiajunhuang picture jiajunhuang  路  7Comments