persistentstorage/centralrepository/test/t_cenrep_back_rest.cpp
changeset 55 44f437012c90
parent 29 cce6680bbf1c
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".
    87 	CleanupStack::PushL( fm );
    87 	CleanupStack::PushL( fm );
    88 	
    88 	
    89 	TInt r = KErrNone;
    89 	TInt r = KErrNone;
    90 
    90 
    91 	r = fm->Delete( KOldInstallFiles );
    91 	r = fm->Delete( KOldInstallFiles );
    92 #ifndef __WINSCW__
       
    93 	if (r == KErrAccessDenied)
    92 	if (r == KErrAccessDenied)
    94 		{
    93 		{
    95 		// we are not able to delete the files on ARM if their attributes are not set correctly.
    94 		// we are not able to delete the files on ARM if their attributes are not set correctly.
    96 		// Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
    95 		// Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
    97 		r = fm->Attribs( KOldInstallFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
    96 		r = fm->Attribs( KOldInstallFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
    98 		User::LeaveIfError(r);
    97 		User::LeaveIfError(r);
    99 		r = fm->Delete( KOldInstallFiles );
    98 		r = fm->Delete( KOldInstallFiles );
   100 		}
    99 		}
   101 #endif
       
   102 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
   100 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
   103 		User::Leave(r);
   101 		User::Leave(r);
   104 	
   102 	
   105 	r = fm->Delete( KOldPersistFiles );
   103 	r = fm->Delete( KOldPersistFiles );
   106 #ifndef __WINSCW__
       
   107 	if (r == KErrAccessDenied)
   104 	if (r == KErrAccessDenied)
   108 		{
   105 		{
   109 		// we are not able to delete the files on ARM if their attributes are not set correctly.
   106 		// we are not able to delete the files on ARM if their attributes are not set correctly.
   110 		// Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
   107 		// Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
   111 		r = fm->Attribs( KOldPersistFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
   108 		r = fm->Attribs( KOldPersistFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
   112 		User::LeaveIfError(r);
   109 		User::LeaveIfError(r);
   113 		r = fm->Delete( KOldPersistFiles );
   110 		r = fm->Delete( KOldPersistFiles );
   114 		}
   111 		}
   115 #endif
       
   116 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
   112 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
   117 		User::Leave(r);
   113 		User::Leave(r);
   118 
   114 
   119 	CleanupStack::PopAndDestroy( fm );
   115 	CleanupStack::PopAndDestroy( fm );
   120 	}
   116 	}