-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Implement Environment.GetEnvironmentVariables for Apple platforms using official API on iOS/tvOS/MacCatalyst #58161
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
Changes from 1 commit
7d697e7
33e5b5d
5eb8dc2
3346036
0e520ab
d9f527b
d55d4ad
30b72b4
8759796
64744d6
316b2f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,16 +92,20 @@ private static Dictionary<string, string> GetSystemEnvironmentVariables() | |
| IntPtr block = Interop.Sys.GetEnviron(); | ||
|
||
| if (block != IntPtr.Zero) | ||
| { | ||
| IntPtr blockIterator = block; | ||
|
|
||
| // Per man page, environment variables come back as an array of pointers to strings | ||
| // Parse each pointer of strings individually | ||
| while (ParseEntry(block, out string? key, out string? value)) | ||
| while (ParseEntry(blockIterator, out string? key, out string? value)) | ||
| { | ||
| if (key != null && value != null) | ||
| results.Add(key, value); | ||
filipnavara marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Increment to next environment variable entry | ||
| block += IntPtr.Size; | ||
| blockIterator += IntPtr.Size; | ||
| } | ||
|
|
||
| Interop.Sys.FreeEnviron(block); | ||
filipnavara marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| return results; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.