Index: sdk/lib/io/platform_impl.dart |
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart |
index 0cffec6a532bd98f77549122771e11297bec48ff..eaad98af995bdb3119f5e654ba2cd75d7d6b29e1 100644 |
--- a/sdk/lib/io/platform_impl.dart |
+++ b/sdk/lib/io/platform_impl.dart |
@@ -58,20 +58,29 @@ class _Platform { |
var isWindows = operatingSystem == 'windows'; |
var result = isWindows ? new _CaseInsensitiveStringMap() : new Map(); |
for (var str in env) { |
- // When running on Windows through cmd.exe there are strange |
- // environment variables that are used to record the current |
- // working directory for each drive and the exit code for the |
- // last command. As an example: '=A:=A:\subdir' records the |
- // current working directory on the 'A' drive. In order to |
- // handle these correctly we search for a second occurrence of |
- // of '=' in the string if the first occurrence is at index 0. |
+ // When running on Windows through cmd.exe there are |
+ // entries which starts with '='. In CMD scripting, |
+ // variables are "dynamic" environment variables which change |
+ // automatically. The values of the ones starting with "=" are |
+ // reified in the environment string of a new program (but, e.g., |
+ // __CD__ isn't). |
+ // |
+ // One example are the use of the environment to communicate the |
+ // current working directory for each drive and the exit code for the |
+ // last command. E.g. the entry '=A:=A:\subdir' records the current |
+ // working directory on the 'A' drive. |
+ // |
+ // On Mac OS an entry of just '=' has been seen. |
+ // |
+ // Entries starting with '=' are ignored. |
+ // |
+ // Entries with no '=' should not happen. If it should happen, |
+ // the entry is ignored. |
var equalsIndex = str.indexOf('='); |
- if (equalsIndex == 0) { |
- equalsIndex = str.indexOf('=', 1); |
+ if (equalsIndex > 0) { |
+ result[str.substring(0, equalsIndex)] = |
+ str.substring(equalsIndex + 1); |
} |
- assert(equalsIndex != -1); |
- result[str.substring(0, equalsIndex)] = |
- str.substring(equalsIndex + 1); |
} |
_environmentCache = new UnmodifiableMapView<String, String>(result); |
} else { |