lowlevellibsandfws/pluginfw/Framework/EcomTestUtils/t_processrfsdeletefile.cpp
changeset 0 e4d67989cc36
child 44 97b0fb8a2cc2
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 // Hepler process with high capability to perform deletion of files 
       
    15 // for using RFs for test harness. 
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <f32file.h>
       
    20 #include <e32debug.h>
       
    21 #include <bautils.h>
       
    22 	
       
    23 TInt DoDeleteFileL(const TDesC& aFile)
       
    24 	{
       
    25 	RFs fs;
       
    26 	fs.Connect();
       
    27 	
       
    28     // Make the file writeable 
       
    29     fs.SetAtt(aFile, 0, KEntryAttReadOnly);
       
    30 	// Delete file using RFs
       
    31 	TInt err = fs.Delete(aFile);
       
    32 	RDebug::Print(_L("RFs Delete file %S - err = %d\n"), &aFile, err);
       
    33 	
       
    34     fs.Close();
       
    35 	return err;
       
    36 	}
       
    37 
       
    38 static TInt DeleteFile(const TDesC& aFile)
       
    39 	{
       
    40 	TRAPD(err,DoDeleteFileL(aFile));
       
    41 	return err;
       
    42 	}
       
    43 
       
    44 GLDEF_C TInt E32Main()
       
    45 	{
       
    46 	CTrapCleanup* cleanup =	CTrapCleanup::New(); 
       
    47 	
       
    48 	TFileName name;
       
    49 	User::CommandLine(name);
       
    50 	TInt err = DeleteFile(name);	
       
    51 	delete cleanup;
       
    52 	return err;
       
    53 	}