linklayercontrol/nullagt/TS_nullagt/src/NullagentPostDelete.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // PRECOPY.CPP
       
    15 // @file
       
    16 // @internalComponent
       
    17 // Pre Copy file preparation
       
    18 // 
       
    19 //
       
    20 
       
    21 // EPOC includes
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 // GenConn Test system includes
       
    26 #include "NullAgentTestSteps.h"
       
    27 
       
    28 //
       
    29 //
       
    30 // Test Pre Copy
       
    31 /* This New Class is added to move copyfile command from script file
       
    32    This test does a copy operation 	
       
    33 */
       
    34 CNullAgentPostDelete::CNullAgentPostDelete()
       
    35 	{
       
    36 	// store the name of this test case
       
    37 	iTestStepName = _L("PostDeleteTest");
       
    38 	}
       
    39 
       
    40 CNullAgentPostDelete::~CNullAgentPostDelete()
       
    41 	{
       
    42 	}
       
    43 
       
    44 // Copy Test Main Code
       
    45 enum TVerdict CNullAgentPostDelete::doTestStepL( void )
       
    46 	{
       
    47 	deleteFileL(KDestPath);
       
    48 	return EPass;
       
    49 	}
       
    50 
       
    51 
       
    52 void CNullAgentPostDelete::deleteFileL (const TDesC& aFileName)
       
    53 	{
       
    54 	// create a fileserver
       
    55 	RFs  fileSystem;
       
    56 
       
    57 	User::LeaveIfError(fileSystem.Connect());
       
    58 	CleanupClosePushL(fileSystem);
       
    59 
       
    60 	// Remove read only flag
       
    61 	TInt ret = fileSystem.SetAtt(aFileName, 0, KEntryAttReadOnly);
       
    62 	if (ret == KErrNotFound)
       
    63 		{
       
    64 		// If file already removed then no need to delete it
       
    65 		Log(_L("File not found"));
       
    66 		CleanupStack::PopAndDestroy(&fileSystem);
       
    67 		return;
       
    68 		}
       
    69 	User::LeaveIfError(ret);
       
    70 
       
    71 	Log(_L("Set file to read only"));
       
    72 
       
    73 	// Delete file
       
    74 	User::LeaveIfError(fileSystem.Delete(aFileName));
       
    75 	Log(_L("deleted file"));
       
    76 
       
    77 	// clean up
       
    78 	CleanupStack::PopAndDestroy(&fileSystem);
       
    79 	}