-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
When you use FileSystem.Current.AppDataDirectory
it outputs a location that according to the documentation is
...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.
But the output of this on different platforms leads to confusing results.
OS | AppDataDirectory |
---|---|
iOS (simulator) | /Users/bradmoore/Library/Developer/CoreSimulator/Devices/7195125F-89A0-40B7-A8DB-1B343B2AF596/data/Containers/Data/Application/B6A225B4-55DE-447C-A407-6CFA3D118553/Library/ |
macOS | /Users/beeradmoore/Library/ |
Android | /data/user/0/com.beeradmoore.myAppName/files/ |
Windows | C:\Users\beeradmoore\AppData\Local\Packages\52ed336e-9df8-43e1-9c04-74392cd48f3d-218743784238_fids9vfx8fwe\LocalState\ |
I believe that using AppDataDirectory
should give a directory specific to your application. However on macOS it drops you into the root folder of where many applications place files. RIP my ~/Library/ folder which is now a mess on account of not even being able to debug basic strings anymore.
I would propose that for macOS PlatformAppDataDirectory created a folder with application name in either ~/User/Library/<application_name>/
or ~/Library/Application Support/<application_name>/
to give consistent behaviour across all platforms (application_name could also be bundle_id)
Additionally I don't know if these files (possibly those Windows) are backed up by the OS to any cloud.
Steps to Reproduce
Create a MAUI app and run this on different platforms.
System.Diagnostics.Debug.WriteLine(FileSystem.Current.AppDataDirectory");
Version with bug
6.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
macOS 12.4
Did you find any workaround?
Custom handle file paths when building MAUI app for macOS.
Relevant log output
No response