Environment.SpecialFolder.ApplicationData or FileSystem.Current.AppDataDirectory ?? #29351
Replies: 2 comments
-
Debug.WriteLine($"FileSystem.Current.AppDataDirectory: {FileSystem.Current.AppDataDirectory}");
Debug.WriteLine($"Environment.SpecialFolder.ApplicationData: {Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}"); FileSystem.Current.AppDataDirectory: /Users/davidortinau/Library/Developer/CoreSimulator/Devices/802B6FB8-01D7-42D9-ABB1-0EBAB5B31763/data/Containers/Data/Application/A418981A-9D17-4E10-8F82-5C1362DEAA29/Library
Environment.SpecialFolder.ApplicationData: /Users/davidortinau/Library/Developer/CoreSimulator/Devices/802B6FB8-01D7-42D9-ABB1-0EBAB5B31763/data/Containers/Data/Application/A418981A-9D17-4E10-8F82-5C1362DEAA29/Documents/.config Use what your app needs. Choose the directory that is most appropriate for the requirement. FileSystem helpers give you the most consistency across platforms so that you're using the right locations depending on the usage of those files. Make sure you understand the purpose of each location as noted in the documentation. Still, you could continue using So the correct answer is the one that gets you to the appropriate folder for your app usage requirements. |
Beta Was this translation helpful? Give feedback.
-
ok, so the old one is still a good option, thank you very much! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, we are migrating a xamarin app to MAUI.
In the old code we had this:
percorsoFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), file.FileName);
but it seems that reading this documentation on MAUI https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-system-helpers?view=net-maui-9.0&tabs=android we need to use the FileSystem.Current.AppDataDirectory
is that correct? The new solution is going to work as the old one and in the Ios simulators too?
thank you very much
Beta Was this translation helpful? Give feedback.
All reactions