Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ public static MauiAppBuilder ConfigureEnvironmentVariables(this MauiAppBuilder b
// If the file not exists, we will use the default environment variables which is less stable
if (OperatingSystem.IsAndroid() && System.IO.File.Exists(androidEnvVarFilePath))
{
var envVarLines = System.IO.File.ReadAllLines(androidEnvVarFilePath);

var fileEnvironmentVariables = envVarLines
.Select(line => line.Split('=', 2))
.ToDictionary(parts => parts[0], parts => parts[1]);

// Merge file environment variables into the existing environment variables
foreach (var kvp in fileEnvironmentVariables)
foreach (var line in System.IO.File.ReadLines(androidEnvVarFilePath))
{
environmentVariables[kvp.Key] = kvp.Value;
int index = line.IndexOf('=', StringComparison.Ordinal);
if (index > 0)
{
string key = line.Substring(0, index);
string value = line.Substring(index + 1); // May be empty for values like "KEY="
environmentVariables[key] = value;
}
Comment on lines +55 to +61
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see a good way to write a test, @jfversluis can you check that Aspire still works with this change?

}
}
#endif
Expand Down
Loading