I am generating a file in a .NET MAUI application, and I want to save it to the Files folder. I followed the issue asking about how to save a temporary file in .NET MAUI, but I want my output to be "permanent" location (well, until the user deletes it, anyway).
I am using the following code:
string FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "myfile.gz");
byte[] arr = GetDataToSave();
await File.WriteAllBytesAsync(fileName, arr);
I'm running this code on an Android emulator, and I'm expecting to see a file created here:
I'm looking for the file so I can drag it to my Windows machine and inspect the contents to make sure I created the file successfully. But, it's not showing up.
How can I save a file from .NET Maui in such a way that I can see it in Files on the Android Emulator?
