-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mono] Implement Environment.GetFolderPath for Android #35490
Comments
When running the following as a functional test
I get the following output in the log:
It seems to be expected behavior. |
On the other hand, looking at the entire list of special folder, it still consists mostly of empty values:
|
Related PR but for iOS: #34022 |
Is HOME set on Android? It would explain why UserProfile and MyDocuments are set, but nothing else is |
Old Mono had a fallback to |
It would also explain why CI never caught this - the only SpecialFolders we validate in CI are "is MyDocuments equal to $HOME" |
Maybe we can use: runtime/src/libraries/System.Private.CoreLib/src/System/IO/PersistedFiles.Unix.cs Line 82 in 57bfe47
$HOME env var directly for Android?it does fallback to getpwuid_r for $HOME -less case: runtime/src/libraries/System.Private.CoreLib/src/System/IO/PersistedFiles.Unix.cs Line 125 in 57bfe47
|
As per #35490 (comment) the only case which is already fine is HOME (i.e. MyDocuments and UserProfile share a code path in runtime/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs Lines 87 to 89 in 39135a4
PersistedFiles.GetHomeDirectory(); )
HOME is the only case that's already fine, I don't think it matters whether that's fed by |
Aha, okay! I understood that the other cases are broken because |
Looks like src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs is relying on XDG (Linux desktop spec) directory discovery on non-OSX |
Okay, even with the XDG code paths, there are a few entries which should be specified but aren't on Android, e.g.:
Which has me thinking the problem is GetFolderPathCore is called, but failing on Android (i.e. because What is the correct behaviour for Android? Unilaterally create the directories, or simply don't try to validate them? What did Legacy MonoDroid do? @jonpryor/@jonathanpeppers? |
The code sample above, legacy Xamarin.Android prints:
I definitely wouldn't try to create the directories. The value for |
So how about on Android, we switch from |
The following snippet:
doesn't print anything for os=Android (all values are empty).
For reference, here is what current Xamarin.Android returns for my simple app:
The text was updated successfully, but these errors were encountered: