dotnet / docs-maui

This repository contains documentation for .NET Multi-platform App UI (MAUI).
https://docs.microsoft.com/dotnet/maui
Creative Commons Attribution 4.0 International
222 stars 194 forks source link

Clarity on the where to store user data files #919

Open rogersm-uwosh opened 1 year ago

rogersm-uwosh commented 1 year ago

The documentation explains that the App data directory is "To get the app's top-level directory for any files that aren't user data files. These files are backed up with the operating system syncing framework."

I realize that most of the people reading this documentation are long-time Xamarin.forms users, and probably understand exactly what the previous sentence means, but it begs the question -- where should user data files be stored? The cache directory is temporary, so we can't use that; and bundled files are read-only.

After much Googling, it turns out that the App data directory is for iCloud and whatever Google Drive (?) files, so permission is an issue.

After more Googling, and reading over the Notes tutorial, I was able to discover this:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

But it would be nice if the docs spelled this out clearly, or at least mentioned it.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

adegeo commented 1 year ago

Hi @rogersm-uwosh

The Platform Differences section explains the path locations for each platform, such as iDrive.

Regarding the notes tutorial, I should probably swap that out for this API as it's the prescribed way to access the folder instead of relying on environment variables.

Let me know if this is the information you're looking for.

rogersm-uwosh commented 1 year ago

I did figure out what I needed to know - I was merely suggesting an improvement to the documentation so others could get all that info in one spot.

Michael

Dr. Michael Rogers Assistant Professor, Computer Science University of Wisconsin Oshkosh Office: 214 Halsey Science Center Social Media (Twitter/FB/Instagram): mprogers Text/Phone: 309-825-6454 Hobbies: Angel Flights, Crossword Solving / Podcastinghttps://podcasts.apple.com/us/podcast/jean-mike-do-the-new-york-times-crossword/id1519692249 Pronouns: he, him, his

On Sep 27, 2022, at 1:12 PM, Andy (Steve) De George @.**@.>> wrote:

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hi @rogersm-uwoshhttps://github.com/rogersm-uwosh

The Platform Differences sectionhttps://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-system-helpers?tabs=android#platform-differences explains the path locations for each platform, such as iDrive.

Regarding the notes tutorial, I should probably swap that out for this API as it's the prescribed way to access the folder instead of relying on environment variables.

Let me know if this is the information you're looking for.

— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/docs-maui/issues/919#issuecomment-1259877237, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVZSBUF2JJ4QI24UTCAYGUTWAM2JVANCNFSM6AAAAAAQWJGP5Y. You are receiving this because you were mentioned.Message ID: @.***>

adegeo commented 1 year ago

Understood. I'm asking about this internally to see what we can clarify. Thank you for raising this question.

davidbritch commented 1 year ago

@adegeo There's content, buried deep in the Xamarin docs, that lists where the different Environment.SpecialFolder.* properties map on iOS/Android. It's always been planned to bring that content into the MAUI docs (#948), along with guidance on where users should store data.

Nerves82 commented 1 week ago

Is there any documentation on where to store a local database that we DON'T want to get backed up to the cloud via the OS syncing framework? Or a way to prevent backup for said files, such as permissions?