crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/Environment/SymbianCommandLineEnvValidator.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Collections.Specialized;
       
    20 using System.Text;
       
    21 using System.Diagnostics;
       
    22 
       
    23 namespace SymbianUtils.Environment
       
    24 {
       
    25     public class SymbianCommandLineEnvValidator
       
    26     {
       
    27         #region API
       
    28         public static bool CheckEnvVarsValidForSymbianOSCompilation( bool aShowWarningDialogs )
       
    29         {
       
    30             bool valid = false;
       
    31             //
       
    32             ProcessStartInfo info = new ProcessStartInfo( "calc.exe" );
       
    33             info.UseShellExecute = false;
       
    34 
       
    35             // Check env vars and make sure standard epoc32 paths are included 
       
    36             StringDictionary envVars = info.EnvironmentVariables;
       
    37 
       
    38             string path = envVars[ "PATH" ];
       
    39             string epocRoot = envVars[ "EPOCROOT" ];
       
    40 
       
    41             if ( path.IndexOf( @"\epoc32\tools" ) < 0 )
       
    42             {
       
    43                 if ( aShowWarningDialogs )
       
    44                 {
       
    45                     System.Windows.Forms.MessageBox.Show( @"Your path doesn't appear to support the necessary" + System.Environment.NewLine +
       
    46                                                           @"\Epoc32\... environment variables.",
       
    47                                                           "EPOC Environment Variables Undefined" );
       
    48                 }
       
    49             }
       
    50             else if ( epocRoot == string.Empty )
       
    51             {
       
    52                 if ( aShowWarningDialogs )
       
    53                 {
       
    54                     System.Windows.Forms.MessageBox.Show( @"You need to define EPOCROOT, e.g. to the value '\'",
       
    55                                                           "EPOCROOT Undefined" );
       
    56                 }
       
    57             }
       
    58             else if ( epocRoot != @"\" )
       
    59             {
       
    60                 if ( aShowWarningDialogs )
       
    61                 {
       
    62                     System.Windows.Forms.MessageBox.Show( @"The Active Object toolkit requires EPOCROOT be set to '\'",
       
    63                                                           "EPOCROOT Value Not Supported" );
       
    64                 }
       
    65             }
       
    66             else
       
    67             {
       
    68                 valid = true;
       
    69             }
       
    70             //
       
    71             return valid;
       
    72         }
       
    73         #endregion
       
    74     }
       
    75 }