secureswitools/swisistools/source/interpretsislib/installer.cpp
changeset 42 d17dc5398051
parent 33 8110bf1194d1
child 50 c6e8afe0ba85
--- a/secureswitools/swisistools/source/interpretsislib/installer.cpp	Thu May 27 12:58:35 2010 +0300
+++ b/secureswitools/swisistools/source/interpretsislib/installer.cpp	Fri Jun 11 13:45:18 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -255,6 +255,56 @@
 	}
 }
 
+void Installer::ProcessConditionalBlockWarnings(const CSISInstallBlock& aInstallBlock, 
+											  ExpressionEvaluator& aEvaluator,
+											  const SisFile& aFile
+											  ) 
+	{
+	const CSISArray<CSISIf, CSISFieldRoot::ESISIf>& ifs = aInstallBlock.Ifs();
+	for (int i = 0; i < ifs.size(); ++i)
+		{
+		const CSISIf& ifBlock = ifs[i];
+
+		if (ifBlock.WasteOfSpace())
+			{
+			return;
+			}
+
+		// Main expression
+		if ( aEvaluator.Evaluate(ifBlock.Expression(),false).BoolValue() )
+			{
+			ProcessInstallBlockWarnings(ifBlock.InstallBlock(), aFile);
+			ProcessConditionalBlockWarnings(ifBlock.InstallBlock(), aEvaluator, aFile);
+			continue;
+			}
+		
+		int elseCount = ifBlock.ElseIfCount();
+		for (int i = 0; i < elseCount; ++i)
+			{
+			const CSISElseIf& elseIfBlock = ifBlock.ElseIf(i) ;
+			if ( aEvaluator.Evaluate(elseIfBlock.Expression(),false).BoolValue())
+				{
+				ProcessInstallBlockWarnings(elseIfBlock.InstallBlock(), aFile);
+				ProcessConditionalBlockWarnings(elseIfBlock.InstallBlock(), aEvaluator, aFile);
+				break;	// Stop processing else if blocks
+				}
+			}
+		} 
+	}
+
+void Installer::ProcessInstallBlockWarnings(const CSISInstallBlock& aInstallBlock, const SisFile& aFile)
+	{
+	aFile.ProcessEmbeddedFileWarning(aInstallBlock);
+	
+	std::string error;
+	bool result = aFile.ProcessInstallOptionsWarning(aInstallBlock,error);	
+	if(result == false)
+		{
+		std::string x;
+		throw InvalidSis(Ucs2ToUtf8(aFile.GetPackageName(),x),
+			error, SIS_NOT_SUPPORTED);
+		}
+	}
 
 TInt Installer::Install(const InstallSISFile& aInstallSISFile)
 {
@@ -273,6 +323,9 @@
 	// check file is acceptable
 	file.CheckValid();
 
+	const CSISController& ctrl = file.GetController();	
+	ProcessConditionalBlockWarnings(ctrl.InstallBlock(), *iExpressionEvaluator, file);
+	
 	if (!DependenciesOk(file))
 	{
 		return MISSING_DEPENDENCY;