Author: mcconnell
Date: Sun May 30 17:08:01 2004
New Revision: 20666

Modified:
   avalon/trunk/runtime/util/env/src/java/org/apache/avalon/util/env/Env.java
Log:
Apply patch from Juergen Guettler (via Alex) re. ME compatibility.

Modified: 
avalon/trunk/runtime/util/env/src/java/org/apache/avalon/util/env/Env.java
==============================================================================
--- avalon/trunk/runtime/util/env/src/java/org/apache/avalon/util/env/Env.java  
(original)
+++ avalon/trunk/runtime/util/env/src/java/org/apache/avalon/util/env/Env.java  
Sun May 30 17:08:01 2004
@@ -107,21 +107,9 @@
         {
             Properties l_props = getUnixShellVariables() ;
             return l_props.getProperty( a_name ) ;
-        }
-        else if ( -1 != l_osName.indexOf( "Windows" ) ) 
+        }
+        else if ( isWindows() ) 
         {
-              if ( null == s_shell )
-              {
-                if ( -1 != l_osName.indexOf( "98" ) || 
-                  -1 != l_osName.indexOf( "95" ) )
-                {
-                    s_shell = "command.exe" ;
-                }
-                else
-                {
-                    s_shell = "cmd.exe" ;
-                }
-              }
             return getWindowsShellVariable( a_name ) ;
         }
         
@@ -452,7 +440,7 @@
     /**
      * Gets the shell used by the Windows user.
      * 
-     * @return the shell: cmd.exe or command.exe.
+     * @return the shell: cmd.exe or command.com.
      */
     private static String getWindowsUserShell()
     {
@@ -461,9 +449,11 @@
             return s_shell ;
         }
         
-        if ( -1 != OSNAME.indexOf( "98" ) || -1 != OSNAME.indexOf( "95" ) )
+        if ( -1 != OSNAME.indexOf( "98" ) 
+          || -1 != OSNAME.indexOf( "95" ) 
+          || -1 != OSNAME.indexOf( "Me" ) )
         {
-            s_shell = "command.exe" ;
+            s_shell = "command.com" ;
             return s_shell ;
         }
 
@@ -482,17 +472,10 @@
         Process l_proc = null ;
         BufferedReader l_in = null ;
         Properties l_props = new Properties() ;
-        StringBuffer l_cmd = new StringBuffer() ;
 
-        // build the command based on the shell used: cmd.exe or command.exe 
-        if ( -1 != OSNAME.indexOf( "98" ) || -1 != OSNAME.indexOf( "95" ) )
-        {
-            l_cmd.append( "command.exe /C SET" ) ;
-        }
-        else
-        {
-            l_cmd.append( "cmd.exe /C SET" ) ;
-        }
+        // build the command based on the shell used: cmd.exe or command.com 
+        StringBuffer l_cmd = new StringBuffer( getWindowsUserShell() ) ;
+        l_cmd.append( " /C SET" ) ;
         
         // fire up the shell and get echo'd results on stdout
         try

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to