How to correctly access existing files in the app data folder created with an Xamarin.Forms app inside a migrated MAUI app? #21438
ewerspej
started this conversation in
Upgrading from Xamarin
Replies: 2 comments 2 replies
-
@ewerspej Thanks for bringing this to light. This is a huge migration issue and I'm surprised (or maybe not at this point) that this topic is not getting any attention. Per the guidelines you posted, LocalApplicationData is the appropriate area for an app database. That pathway should not have changed without some sort of HUGE warning that this was happening. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've already asked this in a Stack Overflow question, but it seems appropriate to also ask this here:
Is there an official migration path for accessing files in the local application data folder on Android?
Consider the following code in a Xamarin.Forms and a migrated .NET MAUI app:
In Xamarin.Forms, the resulting path on Android is (just like it's documented here):
However, when using the exact same code in MAUI, the resulting path on Android is:
I've resolved this issue by appending ".local/share" to the provided path on Android:
Note: The code above is just exemplary, the actual solution would use preprocessor directives or multi-targeting and constants for the file paths and a const ".local/share" string.
What's the recommended course of action? Is this the way to migrate Xamarin.Forms apps to .NET MAUI when trying to access existing files in an upgraded app?
Beta Was this translation helpful? Give feedback.
All reactions