Created attachment 16073 [details]
Version info provided by Xamarin Studio
var myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
will return the same as if called with Environment.SpecialFolder.UserProfile on OS X
So "/Users/username", instead of "/Users/username/Documents" (on a mac with language EN)
The code in question is here:
This is by design.
Unfortunately SpecialFolder.Personal has same value as SpecialFolder.MyDocuments so we cannot easily distinguish between them hence we return /Users/username which sort of fits to both of them.
A workaround then. The link below is for iOS, but it worked for me on OS X 10.10 as well:
And the code based on the link which makes it:
var myDocumentsDir = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User).Path;
Norbert is correct. We are treating Personal and MyDocument the same as UserProfile.
From the RS definition of SpecialFolder:
UserProfile = Win32Native.CSIDL_PROFILE
Personal = Win32Native.CSIDL_PERSONAL
MyDocuments = Win32Native.CSIDL_PERSONAL
And if we look at the CSIDL definitions:
CSIDL_PROFILE: The user's profile folder. A typical path is C:\Users\username.
CSIDL_PERSONAL: The virtual folder that represents the My Documents desktop item. This is equivalent to CSIDL_MYDOCUMENTS. A typical path is C:\Documents and Settings\username\My Documents.
So yes, Personal and MyDocuments are the same, but we've been treating Personal as UserProfile, which is a bug in Mono on Mac.
So on a Mac it should be (and if not the paths below, whatever blessed NSFileManager API makes sense, as Norbert points out):
UserProfile → $HOME
Personal → $HOME/Documents
MyDocuments → $HOME/Documents
We could try to change Personal/MyDocuments case with some fall-back option to old behaviour