Skip to content

Commit 3c55e9a

Browse files
Rodrigo Moyajonathanpeppers
andauthored
Avoid Environment.SpecialFolder.ApplicationData (#188)
* Don't use ApplicationData for config file on UNIX When running on NET6 (VSMac installer), SpecialFolder.ApplicationData returns nothing, resulting in a relative path being used for the config file. So, just switch to use UserProfile, to which we append .config for the well known, and expected, place for the config file. Example testing with Mono's `csharp` command: $ csharp Mono C# Shell, type "help;" for help Enter statements below. csharp> Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) "/Users/jopepper/.config" csharp> Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) "/Users/jopepper" Co-authored-by: Jonathan Peppers <[email protected]>
1 parent 0d55472 commit 3c55e9a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkUnix.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ private static string UnixConfigPath {
223223
get {
224224
var p = AppDomain.CurrentDomain.GetData (GetUnixConfigDirOverrideName)?.ToString ();
225225
if (string.IsNullOrEmpty (p)) {
226-
p = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
227-
p = Path.Combine (p, "xbuild");
226+
p = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", "xbuild");
228227
}
229228
return Path.Combine (p, "monodroid-config.xml");
230229
}

0 commit comments

Comments
 (0)