Re: sysinfo task
Dominik Guder <[email protected]> Sat, 14 Aug 2010 23:32:45 +0200
| Newsgroups | gmane.comp.windows.dotnet.nant.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, IMHO there is still the minor changes pending in cvs: 1) fix docu issue 2) display properties sorted in verbose mode maybe some comitter could take a look. Thanks Dominik -------- Original-Nachricht -------- Betreff: Re: [nant-dev] sysinfo task Datum: Thu, 25 Mar 2010 11:34:20 +0100 Von: Dominik Guder <[email protected]> An: [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 ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ nant-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-developers
sysinfo-task-docu-error.patch
(text/plain, 704 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, 1011 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)