diff options
author | lateralusX <lateralusx.github@gmail.com> | 2018-11-14 11:42:44 +0300 |
---|---|---|
committer | lateralusX <lateralusx.github@gmail.com> | 2018-11-14 11:42:44 +0300 |
commit | e6123028ae355b2305f4f15fa5c96d0dc0f2a662 (patch) | |
tree | ba7442ac1d32635f2ab4fedb7ebdf609a2973d34 /msvc/mono.external.targets | |
parent | ab33926c895ed805d5d2f7c222ca6879ba1273d5 (diff) |
Fix scenario before cygconf.h has been created in build-init.
Diffstat (limited to 'msvc/mono.external.targets')
-rw-r--r-- | msvc/mono.external.targets | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/msvc/mono.external.targets b/msvc/mono.external.targets index 5e2a3eed2bd..3489b874acc 100644 --- a/msvc/mono.external.targets +++ b/msvc/mono.external.targets @@ -10,6 +10,9 @@ <ConfPropertyFoundMatch ParameterType="System.String" Output="true" /> </ParameterGroup> <Task> + <Using Namespace="System" /> + <Using Namespace="System.Text.RegularExpressions" /> + <Using Namespace="System.IO" /> <Code Type="Fragment" Language="cs"> <![CDATA[ @@ -17,30 +20,33 @@ ConfPropertyValue = ""; ConfPropertyFoundMatch = "false"; - var regex = new System.Text.RegularExpressions.Regex (ConfRegEx); - using (StreamReader reader = new StreamReader(ConfFile)) + if (File.Exists (ConfFile)) { - string line; - while ((line = reader.ReadLine ()) != null) + var regex = new Regex (ConfRegEx); + using (StreamReader reader = new StreamReader(ConfFile)) { - var match = regex.Match (line); - if (match != null && match.Success) + string line; + while ((line = reader.ReadLine ()) != null) { - if (match.Groups != null && match.Groups.Count == 1) + var match = regex.Match (line); + if (match != null && match.Success) { - var propertyLine = match.Groups[0].ToString (); - if (!String.IsNullOrEmpty (propertyLine)) + if (match.Groups != null && match.Groups.Count == 1) { - var propertyLineItems = propertyLine.Split ('='); - if (propertyLineItems != null && propertyLineItems.Length == 2) + var propertyLine = match.Groups[0].ToString (); + if (!String.IsNullOrEmpty (propertyLine)) { - ConfPropertyName = propertyLineItems[0].Trim (); - ConfPropertyValue = propertyLineItems[1].Trim (); + var propertyLineItems = propertyLine.Split ('='); + if (propertyLineItems != null && propertyLineItems.Length == 2) + { + ConfPropertyName = propertyLineItems[0].Trim (); + ConfPropertyValue = propertyLineItems[1].Trim (); + } } } + ConfPropertyFoundMatch = "true"; + break; } - ConfPropertyFoundMatch = "true"; - break; } } } |