New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File dialog locations #1379
File dialog locations #1379
Conversation
This swaps ~/ and ./ as the default directory. I have also made / the failover if both of those error. That *shouldn't* happen though. Note that / should be safe even on Windows, since NT supports POSIX-style paths. `/` should expand to NTFS's root, which is almost always `C:\`. XXX: might be worth setting the failover dir in the platform driver. `/` is probably not a good failover choice for iOS, although I'm not sure the file dialog even makes sense there, since they have their own system one? I'm not an iOS dev, so I'm not sure.
This adds the concept of a "starting directory", which may be set with a new setter method. If there is a problem with this directory, or it is an empty string, then the CWD is preferred, followed by the user home, followed by `/`. This also adds two new utility methods, ShowFileOpenAt, and ShowFileSaveAt which allow the starting directory to be explicitly set as arguments. This should not break the existing API.
Per @andydotxyz I have moved the logic to calculate the starting directory for the file dialog widget to it's own function.
This implements just the effectiveStartingDir() and a basic test from PR fyne-io#1108. It does provide the ability to set a custom starting dir. Cherry picked from fyne-io#1111 to fyne-io#1108 to avoid future merge conflicts.
Fix some issues related to ListableURI and dialog
File dialog locations
…ls/fyne into file_dialog_locations
OK that's all comments addressed. I am not certain now if StartingLocation is right - should we instead use SetLocation (so it's not start specific) or make it a Location field that can be written or read... |
Also move setDirectory to setLocation to be consistent
Thanks for your help on this @charlesdaniels and @PucklaMotzer09, I know it's been a long haul but we got there :). |
Description:
Replaces PR #1108
Fixes #821
Checklist:
Where applicable: