persistentstorage/centralrepository/test/t_cenrep_back_rest_delete.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".
    73 
    73 
    74 	CFileMan* fm = CFileMan::NewL( TServerResources::iFs );
    74 	CFileMan* fm = CFileMan::NewL( TServerResources::iFs );
    75 	CleanupStack::PushL( fm );
    75 	CleanupStack::PushL( fm );
    76 
    76 
    77 	TInt r = fm->Delete( KOldInstallFiles );
    77 	TInt r = fm->Delete( KOldInstallFiles );
       
    78 	if (r == KErrAccessDenied)
       
    79 	        {
       
    80 	        // we are not able to delete the files on ARM if their attributes are not set correctly.
       
    81 	        // Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
       
    82 	        r = fm->Attribs( KOldInstallFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
       
    83 	        User::LeaveIfError(r);
       
    84 	        r = fm->Delete( KOldInstallFiles );
       
    85 	        }
    78 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
    86 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
    79 		User::Leave(r);
    87 		User::Leave(r);
    80 	r = fm->Delete( KOldPersistFiles );
    88 	r = fm->Delete( KOldPersistFiles );
       
    89 	if (r == KErrAccessDenied)
       
    90 	        {
       
    91 	        // we are not able to delete the files on ARM if their attributes are not set correctly.
       
    92 	        // Only set attributes when got KErrAccessDenied because it's time consuming in OOM test.
       
    93 	        r = fm->Attribs( KOldPersistFiles, KEntryAttArchive, KEntryAttReadOnly, TTime( 0 ), CFileMan::ERecurse );
       
    94 	        User::LeaveIfError(r);
       
    95 	        r = fm->Delete( KOldPersistFiles );
       
    96 	        }
    81 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
    97 	if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound )
    82 		User::Leave(r);
    98 		User::Leave(r);
    83 
    99 
    84 	CleanupStack::PopAndDestroy( fm );
   100 	CleanupStack::PopAndDestroy( fm );
    85 	}
   101 	}