Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: runtime/bin/platform_win.cc

Issue 831213002: Omit variables beginning with "=" from Windows environment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update documentation. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/platform_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_win.cc
diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc
index 0d3cb11c2f15306bf94199380fa46d69e509e80d..d56c9712bfe62105dfecfb5bd071d69f0c22a01d 100644
--- a/runtime/bin/platform_win.cc
+++ b/runtime/bin/platform_win.cc
@@ -44,14 +44,19 @@ char** Platform::Environment(intptr_t* count) {
wchar_t* tmp = strings;
intptr_t i = 0;
while (*tmp != '\0') {
- i++;
+ // Skip environment strings starting with "=".
+ // These are synthetic variables corresponding to dynamic environment
+ // variables like %=C:% and %=ExitCode%, and the Dart environment does
+ // not include these.
+ if (*tmp != '=') i++;
tmp += (wcslen(tmp) + 1);
}
*count = i;
char** result = new char*[i];
tmp = strings;
- for (intptr_t current = 0; current < i; current++) {
- result[current] = StringUtils::WideToUtf8(tmp);
+ for (intptr_t current = 0; current < i;) {
+ // Skip the strings that were not counted above.
+ if (*tmp != '=') result[current++] = StringUtils::WideToUtf8(tmp);
tmp += (wcslen(tmp) + 1);
}
FreeEnvironmentStringsW(strings);
« no previous file with comments | « no previous file | sdk/lib/io/platform_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698