linklayercontrol/nullagt/TS_nullagt/src/NullagentPostDelete.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 13:53:10 +0300
branchRCL_3
changeset 67 bb2423252ea3
parent 0 af10295192d8
permissions -rw-r--r--
Revision: 201036 Kit: 201036

// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// PRECOPY.CPP
// @file
// @internalComponent
// Pre Copy file preparation
// 
//

// EPOC includes
#include <e32base.h>
#include <f32file.h>

// GenConn Test system includes
#include "NullAgentTestSteps.h"

//
//
// Test Pre Copy
/* This New Class is added to move copyfile command from script file
   This test does a copy operation 	
*/
CNullAgentPostDelete::CNullAgentPostDelete()
	{
	// store the name of this test case
	iTestStepName = _L("PostDeleteTest");
	}

CNullAgentPostDelete::~CNullAgentPostDelete()
	{
	}

// Copy Test Main Code
enum TVerdict CNullAgentPostDelete::doTestStepL( void )
	{
	deleteFileL(KDestPath);
	return EPass;
	}


void CNullAgentPostDelete::deleteFileL (const TDesC& aFileName)
	{
	// create a fileserver
	RFs  fileSystem;

	User::LeaveIfError(fileSystem.Connect());
	CleanupClosePushL(fileSystem);

	// Remove read only flag
	TInt ret = fileSystem.SetAtt(aFileName, 0, KEntryAttReadOnly);
	if (ret == KErrNotFound)
		{
		// If file already removed then no need to delete it
		Log(_L("File not found"));
		CleanupStack::PopAndDestroy(&fileSystem);
		return;
		}
	User::LeaveIfError(ret);

	Log(_L("Set file to read only"));

	// Delete file
	User::LeaveIfError(fileSystem.Delete(aFileName));
	Log(_L("deleted file"));

	// clean up
	CleanupStack::PopAndDestroy(&fileSystem);
	}