persistentstorage/centralrepository/test/t_cenrep_helper.cpp
changeset 55 44f437012c90
parent 0 08ec8eefde2f
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   119 	CleanupStack::PushL(fm);
   119 	CleanupStack::PushL(fm);
   120 	HBufC* file_buf = HBufC::NewLC(KMaxFileName);
   120 	HBufC* file_buf = HBufC::NewLC(KMaxFileName);
   121 	TPtr file(file_buf->Des());
   121 	TPtr file(file_buf->Des());
   122 	file.Copy(KCPersistsFiles);
   122 	file.Copy(KCPersistsFiles);
   123 	PatchDrive(file);
   123 	PatchDrive(file);
   124 	TInt r = fm->Delete(file);
   124 	TInt r = fm->Attribs(file, 0, KEntryAttReadOnly, TTime(0), 0);
   125 
   125     if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
   126 	if (r != KErrNone &&
   126         {
   127 		r != KErrNotFound &&
   127         User::Leave(r);
   128 		r != KErrPathNotFound)
   128         }
   129 		{
   129 	r = fm->Delete(file);
   130 		User::Leave(r);
   130 	if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
   131 		}
   131 		{
   132 		
   132 		User::Leave(r);
   133 	if(aRemoveRomCache)
   133 		}
       
   134 	
       
   135 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC)
       
   136 	file.Copy(KPMAFiles);
       
   137     PatchDrive(file);
       
   138     r = fm->Attribs(file, 0, KEntryAttReadOnly, TTime(0), 0);
       
   139     if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
       
   140         {
       
   141         User::Leave(r);
       
   142         }
       
   143     r = fm->Delete(file);
       
   144     if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
       
   145         {
       
   146         User::Leave(r);
       
   147         }
       
   148 #endif		
       
   149 
       
   150     if(aRemoveRomCache)
   134 		{
   151 		{
   135 		//Delete cached rom version file
   152 		//Delete cached rom version file
   136 		file.Copy(KCRomVersionFiles);
   153 		file.Copy(KCRomVersionFiles);
   137 		PatchDrive(file);
   154 		PatchDrive(file);
   138 		fm->Attribs(file, 0, KEntryAttReadOnly, TTime(0), 0);
   155 		r = fm->Attribs(file, 0, KEntryAttReadOnly, TTime(0), 0);
       
   156 	    if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
       
   157 	        {
       
   158 	        User::Leave(r);
       
   159 	        }
   139 		r = fm->Delete(file);
   160 		r = fm->Delete(file);
   140 		if (r != KErrNone &&
   161 		if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound && r != KErrPermissionDenied)
   141 			r != KErrNotFound &&
       
   142 			r != KErrPathNotFound &&
       
   143 			r != KErrPermissionDenied)
       
   144 			{
   162 			{
   145 			User::Leave(r);
   163 			User::Leave(r);
   146 			}
   164 			}
   147 		
   165 		
   148 		// Delete all install files
   166 		// Delete all install files
   149 		file.Copy(KCInstallFiles);
   167 		file.Copy(KCInstallFiles);
   150 		PatchDrive(file);	
   168 		PatchDrive(file);
       
   169 		r = fm->Attribs(file, 0, KEntryAttReadOnly, TTime(0), 0);
       
   170 	    if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
       
   171 	        {
       
   172 	        User::Leave(r);
       
   173 	        }
   151 		r = fm->Delete(file);
   174 		r = fm->Delete(file);
   152 		if (r != KErrNone &&
   175 		if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound)
   153 			r != KErrNotFound &&
       
   154 			r != KErrPathNotFound)
       
   155 			{
   176 			{
   156 			User::Leave(r);
   177 			User::Leave(r);
   157 			}
   178 			}
   158 
   179 
   159 		// Give SW time to handle uninstall.
   180 		// Give SW time to handle uninstall.
   251 	dest.Copy(aDest);
   272 	dest.Copy(aDest);
   252 				
   273 				
   253 	PatchDrive(dest);
   274 	PatchDrive(dest);
   254 
   275 
   255 	//copy test files
   276 	//copy test files
   256 	User::LeaveIfError(aFm.Copy(src, dest,CFileMan::ERecurse));
   277 	User::LeaveIfError(aFm.Copy(src, dest,CFileMan::ERecurse|CFileMan::EOverWrite));
   257 	aFm.Attribs(dest,
   278 	aFm.Attribs(dest,
   258 					KEntryAttArchive,
   279 					KEntryAttArchive,
   259 					KEntryAttReadOnly,
   280 					KEntryAttReadOnly,
   260 					TTime(0),
   281 					TTime(0),
   261 					CFileMan::ERecurse);		
   282 					CFileMan::ERecurse|CFileMan::EOverWrite);		
   262 	}
   283 	}
   263 
   284 
   264 //This function prints out the recorded time in milliseconds of aTime.
   285 //This function prints out the recorded time in milliseconds of aTime.
   265 EXPORT_C void RecordPerformanceTimingL(TUint32 aTime)
   286 EXPORT_C void RecordPerformanceTimingL(TUint32 aTime)
   266 	{
   287 	{