secureswitools/swisistools/source/interpretsislib/sisfile.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
   205 	if (failed)
   205 	if (failed)
   206 		{
   206 		{
   207 		std::string x = wstring2string(this->GetPackageName());
   207 		std::string x = wstring2string(this->GetPackageName());
   208 		throw InvalidSis(x, error, SIS_NOT_SUPPORTED);
   208 		throw InvalidSis(x, error, SIS_NOT_SUPPORTED);
   209 		}
   209 		}
   210 
       
   211 	}
   210 	}
   212 
   211 
   213 bool SisFile::ProcessInstallOptionsWarning(const CSISInstallBlock& aInstallBlock, std::string& aError)
   212 bool SisFile::ProcessInstallOptionsWarning(const CSISInstallBlock& aInstallBlock, std::string& aError)
   214 	{
   213 	{
   215 	bool success = true;
   214 	bool success = true;
   217 	int fileCount = aInstallBlock.FileCount();
   216 	int fileCount = aInstallBlock.FileCount();
   218 	for(int i = 0; i < fileCount; ++i)
   217 	for(int i = 0; i < fileCount; ++i)
   219 		{
   218 		{
   220 		const CSISFileDescription& fD = aInstallBlock.FileDescription(i);
   219 		const CSISFileDescription& fD = aInstallBlock.FileDescription(i);
   221         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   220         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   222 		std::wstring target(fD.Target().GetString().c_str());
   221 		std::wstring target(fD.Target().GetString());
   223         //
   222         //
   224         switch( operation )
   223         switch( operation )
   225             {
   224             {
   226         case CSISFileDescription::EOpInstall:
   225         case CSISFileDescription::EOpInstall:
   227             success = true;
   226             success = true;
   275     		{
   274     		{
   276 			aError += "SIS File contains install options : "+operation;
   275 			aError += "SIS File contains install options : "+operation;
   277 			break;
   276 			break;
   278 	    	}
   277 	    	}
   279 		}
   278 		}
   280 		return success;
   279 	return success;
   281 	}
   280 	}
   282 
   281 
   283 
   282 
   284 std::wstring SisFile::GetVendorName() const
   283 std::wstring SisFile::GetVendorName() const
   285 	{
   284 	{
   421 		{
   420 		{
   422 		const CSISIf& ifBlock = ifs[i];
   421 		const CSISIf& ifBlock = ifs[i];
   423 
   422 
   424 		if (ifBlock.WasteOfSpace())
   423 		if (ifBlock.WasteOfSpace())
   425 			{
   424 			{
   426 			std::string x;
       
   427 			std::string error = "corrupt SIS file";
   425 			std::string error = "corrupt SIS file";
   428 			throw InvalidSis(Ucs2ToUtf8(this->GetPackageName(),x), error, INVALID_SIS);
   426 			std::string x = wstring2string(this->GetPackageName());
       
   427 			throw InvalidSis(x, error, INVALID_SIS);
   429 			}
   428 			}
   430 
   429 
   431 		// Main expression
   430 		// Main expression
   432 		const ExpressionResult expressionResult = aEvaluator.Evaluate( ifBlock.Expression() );
   431 		const ExpressionResult expressionResult = aEvaluator.Evaluate( ifBlock.Expression() );
   433 		const bool processBlock = expressionResult.BoolValue();
   432 		const bool processBlock = expressionResult.BoolValue();
   444 			if ( aEvaluator.Evaluate(ifElseBlock.Expression()).BoolValue())
   443 			if ( aEvaluator.Evaluate(ifElseBlock.Expression()).BoolValue())
   445 				{
   444 				{
   446 				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
   445 				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
   447 				break;	// Stop processing else if blocks
   446 				break;	// Stop processing else if blocks
   448 				}
   447 				}
   449 			
   448 			// Process the rest of the files
       
   449 			GetInstallableFiles(aFiles, ifElseBlock.InstallBlock(), aDrivePath, aInstallingDrive);
   450 			}
   450 			}
   451 		} 
   451 		} 
   452 	}
   452 	}
   453 
   453 
   454 PackageUids SisFile::GetEmbeddedPackageUids() const
   454 PackageUids SisFile::GetEmbeddedPackageUids() const