Re: sysinfo task
Dominik Guder <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nant.devel |
|---|---|
| Message-ID | <[email protected]> |
> On 64bit systems there are some environment variables which contains > parentheses like *ProgramFiles(x86)* or *CommonProgramFiles(x86)*. > This are invalid property names which cause the sysinfo tasks to fail. > > b) replace any parentheses in env.name with underscores and put this > into docu. > So I would like to go with b) since the properties could be used. > In addition docu states that function *environment::get-variable()* > should be used to retrieve env variables. So I think this won't affect a > lot of users. > Ok, I did some checks and will add some patches for discussion. (text in [[[ ]]] might be used for commit message as seen at svn mailing list) [[[ fix incorrect definition of "failonerror" in <sysinfo> docu. ]]] sysinfo-task-docu-error.patch sysinfo-replace-propname.patch: this is a first implementation to replace "sys.env.ProgramFiles(x86)" with "sys.env.ProgramFiles_x86_" There is still the docu change missing. But I will provide this when we are going this way. Result: --- snip --- [sysinfo] sys.env.ProgramFiles = C:\Programme [sysinfo] sys.env.ProgramFiles_x86_ = C:\Programme --- snap --- [[[ sort sysinfo properties when using verbose="true" ]]] sysinfo-verbose-sorted.patch: This patch will output properties on sorted order in verbose. I found that I need to search more than I like to find my replaced property without this sorting So far Dominik -- The answer to the great question of life, the universe and everything is 42 (Douglas Adams) ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ nant-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-developers
sysinfo-task-docu-error.patch
(text/plain, 703 B)
Index: SysInfo.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.Core/Tasks/SysInfo.cs,v
retrieving revision 1.18
diff -u -r1.18 SysInfo.cs
--- SysInfo.cs 24 May 2005 18:20:22 -0000 1.18
+++ SysInfo.cs 25 Mar 2010 09:56:00 -0000
@@ -89,7 +89,7 @@
/// <para>
/// When the name of an environment variable is not a valid property name,
/// the task will fail. In that case, set <see cref="Task.FailOnError" /> to
- /// <see langword="true" /> to allow that environment variable to be
+ /// <see langword="false" /> to allow that environment variable to be
/// skipped.
/// </para>
/// <note>
sysinfo-replace-propname.patch
(text/plain, 1010 B)
Index: SysInfo.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.Core/Tasks/SysInfo.cs,v
retrieving revision 1.18
diff -u -r1.18 SysInfo.cs
--- SysInfo.cs 24 May 2005 18:20:22 -0000 1.18
+++ SysInfo.cs 25 Mar 2010 09:58:07 -0000
@@ -189,8 +189,10 @@
IDictionary variables = Environment.GetEnvironmentVariables();
foreach (string name in variables.Keys) {
try {
- Properties[Prefix + "env." + name] = (string) variables[name];
- } catch (Exception ex) {
+ string envName = name.Replace('(', '_').Replace(')', '_');
+ Properties[Prefix + "env." + envName] = (string)variables[name];
+ }
+ catch (Exception ex) {
if (!FailOnError) {
Log(Level.Warning, "Property could not be created for"
+ " environment variable '{0}' : {1}", name,
sysinfo-verbose-sorted.patch
(text/plain, 0 B)