secureswitools/swisistools/source/interpretsislib/installer.cpp
changeset 33 8110bf1194d1
parent 25 98b66e4fb0be
child 42 d17dc5398051
equal deleted inserted replaced
29:26b6f0522fd8 33:8110bf1194d1
   303 #else
   303 #else
   304 	try {
   304 	try {
   305 
   305 
   306 		UpdateRegistry(file, installable, aInstallSISFile, aInstallSISFile.iSUFlag);
   306 		UpdateRegistry(file, installable, aInstallSISFile, aInstallSISFile.iSUFlag);
   307 	}
   307 	}
       
   308 	catch  (InterpretSisError& e)
       
   309 	{
       
   310 		RestoreAll(file, installable, iBackupFlag);
       
   311 
       
   312 		LERROR(L"\t" << Utf8ToUcs2(e.what()));
       
   313 		int result =  e.GetErrorCode();
       
   314 		return result;
       
   315 	
       
   316 	}
   308 	catch  (...)
   317 	catch  (...)
   309 	{//Update Registry Failed. UnInstall the files.
   318 	{//Update Registry Failed. UnInstall the files.
   310 		InstallableFiles::const_iterator filedesIter; 
   319 
   311 		std::wstring itargetLocalFile;
   320 		RestoreAll(file, installable, iBackupFlag);
   312 
       
   313 		for(filedesIter = installable.begin() ; filedesIter != installable.end(); ++filedesIter)
       
   314 		{
       
   315 		    itargetLocalFile = (*filedesIter)->GetLocalTarget();
       
   316 			
       
   317 			if (FileExists(itargetLocalFile))
       
   318 			{
       
   319 				RemoveFile(itargetLocalFile);
       
   320 				RemoveHashForFile(itargetLocalFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath());
       
   321 			}
       
   322 		}
       
   323 		Restore(file, installable, iBackupFlag);
       
   324 		FreeInstallableFiles(installable);
       
   325 		return RSC_PARSING_ERROR;
   321 		return RSC_PARSING_ERROR;
   326 	}
   322 	}
   327 
   323 
   328 	if(iBackupFlag)
   324 	if(iBackupFlag)
   329 		RemoveBackup(file, installable);
   325 		RemoveBackup(file, installable);
   592 					LERROR(L"Failed to Restore file ");
   588 					LERROR(L"Failed to Restore file ");
   593 			}
   589 			}
   594 		}
   590 		}
   595 	}
   591 	}
   596 }
   592 }
       
   593 
       
   594 void Installer::RestoreAll(const SisFile& aFile, InstallableFiles& aInstallable, TBool& aBackupFlag)
       
   595 {
       
   596 	InstallableFiles::const_iterator filedesIter; 
       
   597 	std::wstring itargetLocalFile;
       
   598 
       
   599 	for(filedesIter = aInstallable.begin() ; filedesIter != aInstallable.end(); ++filedesIter)
       
   600 	{
       
   601 		itargetLocalFile = (*filedesIter)->GetLocalTarget();
       
   602 		
       
   603 		if (FileExists(itargetLocalFile))
       
   604 		{
       
   605 			RemoveFile(itargetLocalFile);
       
   606 			RemoveHashForFile(itargetLocalFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath());
       
   607 		}
       
   608 	}
       
   609 	Restore(aFile, aInstallable, aBackupFlag);
       
   610 	FreeInstallableFiles(aInstallable);
       
   611 }
       
   612 
   597 #endif
   613 #endif
   598 
   614 
   599 struct CheckDependencyMet
   615 struct CheckDependencyMet
   600 {
   616 {
   601 	CheckDependencyMet(
   617 	CheckDependencyMet(