sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Hepler process with high capability to perform deletion of files for sl@0: // test harnesses. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: void DeleteFileL(const TDesC& aFile) sl@0: { sl@0: TInt r = KErrNone; sl@0: RLoader rloader; sl@0: r = rloader.Connect(); sl@0: if (r != KErrNone) sl@0: { sl@0: User::Leave(r); sl@0: } sl@0: CleanupClosePushL(rloader); sl@0: sl@0: TInt err = rloader.Delete(aFile); sl@0: if ((err != KErrNone) && (err != KErrPathNotFound)) sl@0: User::Leave(err); sl@0: sl@0: CleanupStack::PopAndDestroy(1); sl@0: rloader.Close(); sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: sl@0: TFileName name; sl@0: User::CommandLine(name); sl@0: sl@0: TInt err = KErrNone; sl@0: TRAP(err,DeleteFileL(name)); sl@0: if (err == KErrNone) sl@0: RDebug::Print(_L("RLoader Delete file '%S' succeeded.\n"), &name); sl@0: else sl@0: RDebug::Print(_L("RLoader Delete file '%S' failed with error = %d.\n"), &name, err); sl@0: sl@0: delete cleanup; sl@0: return err; sl@0: }