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: // TTaskFilesChecker.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // This function is used in the test code to check if there's any task files left sl@0: // after scheduled tasks completed sl@0: sl@0: _LIT(KTaskFileScanDir, "_:\\Private\\10005399\\"); sl@0: sl@0: _LIT(KTaskFileWildname, "*.tmp"); sl@0: sl@0: static TInt CheckTaskFilesL() sl@0: { sl@0: RFs fs; sl@0: User::LeaveIfError(fs.Connect()); sl@0: sl@0: //Get the correct system drive sl@0: TBuf<32> taskFilePath(KTaskFileScanDir); sl@0: taskFilePath[0] = RFs::GetSystemDriveChar(); sl@0: sl@0: // Search for task files using wildcard file name sl@0: TFindFile fileFinder(fs); sl@0: CDir* fileList = NULL; sl@0: TInt rel = fileFinder.FindWildByDir(KTaskFileWildname, taskFilePath, fileList); sl@0: sl@0: // delete file list, we won't use it sl@0: if (fileList != NULL) sl@0: delete fileList; sl@0: sl@0: // When any task file found left, leave with error code KErrGeneral sl@0: if (rel == KErrNone) sl@0: rel = KErrGeneral; sl@0: sl@0: // When there's no task file left, return KErrNone sl@0: if (rel == KErrNotFound) sl@0: rel = KErrNone; sl@0: sl@0: // Leave with KErrGeneral or any other error sl@0: User::LeaveIfError(rel); sl@0: return rel; sl@0: } sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: TInt err = KErrNoMemory; sl@0: CTrapCleanup* cleanup=CTrapCleanup::New(); //can fail sl@0: if (cleanup) sl@0: { sl@0: err = KErrNone; sl@0: TRAP(err, CheckTaskFilesL()) sl@0: delete cleanup; sl@0: } sl@0: return err; sl@0: }