I would like to have access to a persistent folder to write cache data to in my cross platform (Mac/Windows) Unity app.
My impression is that on Macs the correct folder should be
~/Library/Application Support/
and on Windows it would be something like
%USERPROFILE%\Local Settings\Application Data\
Now, it seems like there is almost a way to get this cleanly because on Windows I believe the following function returns the right location.
System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData)
Unfortunately for whatever reason it doesn't appear to return the corresponding location on Macs. So my solution was to #ifdef by platform and use this one
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)
which for me resolves to the root of user directory (~/) and then I add the necessary subdirs onto it.
The trouble is that when I started testing my app on other Macs it ended up returning the ~/Documents directory for other users.
Is there a recommended and cleaner way to deal with all of this?