xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.52k stars 506 forks source link

FilePicker support to specify initial directory #1749

Open mathjeff opened 3 years ago

mathjeff commented 3 years ago

Description

Could FilePicker be augmented to allow the caller to specify the initial directory of the file picker?

Maybe PickerOptions ( https://github.com/xamarin/Essentials/blob/db101137e96a8087e2c80ca2676cf3f27adbd1ff/Xamarin.Essentials/FilePicker/FilePicker.shared.cs#L46 ) could offer a field called something like StartLocation that controls the initial directory of the file picker?

Basic Information

Context:

The app that I'm working on offers users the ability to export backups of their data to a user-visible location. I'd like to offer the user the ability to see where these backups are located so they can inspect and restore from them later if need be, by creating a filepicker whose initial location matches the directory where the app puts those backups.

Thanks!

procopio commented 3 years ago

+1 pls

DejaVuMan commented 2 years ago

Likewise, this would be hugely useful for my use-case scenario where I have two separate folders inside of the app's public-private directory storing app-created data. I would love to be able to select those directories to start in with FilePicker, since some users might not be able to figure out at first how to access those directories.

mattenbo commented 2 years ago

I have the same requirement. I am saving app specific txt data to Environment.SpecialFolder.LocalApplicationData and I would like the user to be able to pick from those files. One possibility is for FilePicker to start from the app's current working directory as set by SetCurrentDirectory.