// ----------------------------------------------------------------------------- // CAknFileSelectionModel::ContainsSubfolders // // // ----------------------------------------------------------------------------- // TBool CAknFileSelectionModel::ContainsSubfolders( const TDesC& aFolder ) { TPath directory( iCurrentPath.DriveAndPath() ); directory.Append( aFolder ); AknCFDUtility::AddTrailingBackslash( directory ); // ignore error // Keep old code for possible roll-back /* CDir* array = ReadDirectory( directory ); if( ( !array ) || ( array->Count() == 0 ) || ( !(* array)[ 0 ].IsDir() ) ) { delete array; return EFalse; } delete array; return ETrue; */ RDir dir; TBool ret( EFalse ); if ( dir.Open( iFs, directory, KEntryAttDir | KEntryAttMatchExclusive ) != KErrNone ) { return EFalse; } TEntry entry; if ( dir.Read( entry ) == KErrNone ) { ret = ETrue; } dir.Close(); return ret; }
LOCAL_C void MainL() { test.Start(_L("@SYMTESTCaseID:PIM-ALLDAYEVENTS-0001 Getting list of all day events data....")); RDir dataDir; CleanupClosePushL(dataDir); //Open the Data directory and read the file entries User::LeaveIfError(dataDir.Open(calTestLibrary->FileSession(), KDataDir, KEntryAttNormal)); TEntryArray* dataArray = new (ELeave) TEntryArray(); CleanupStack::PushL(dataArray); dataDir.Read(*dataArray); TInt count = dataArray->Count(); test (count != 0); for (TInt i=0; i < count; ++i) { test.Next(_L("ALLDAYEVENTS-0002")); TBuf<256> name; name = KDataDir; name.Append((*dataArray)[i].iName); RPointerArray<CCalEntry> calEntries; CleanupResetAndDestroyPushL(calEntries); ImportEntriesL(name, calEntries); TInt calEntriesCount = calEntries.Count(); if (calEntriesCount) { //Test entry for the presence of timzone rules and UTC CheckTimezoneRules(*calEntries[0]); } name = KWriteDataDir; name.Append((*dataArray)[i].iName); ExportEntriesL(calEntries, name); TBool result = TestExportedFile(name); if (result) { calTestLibrary->FileSession().Delete(name); } CleanupStack::PopAndDestroy(&calEntries); } CleanupStack::PopAndDestroy(dataArray); CleanupStack::PopAndDestroy(&dataDir); // This will fail if there was a parsing error in one or more of the data files // which will still be then present in the directory for inspecting. test (calTestLibrary->FileSession().RmDir(KWriteDataDir) == KErrNone); test.End(); test.Close(); }
void CheckNonMatch(const TDesC& aFileName) { TInt r; RDir dir; TFileName name; name = KPath; name.Append(aFileName); r = dir.Open(TheFs, name, KEntryAttNormal); test_KErrNone(r); TEntry entry; r = dir.Read(entry); test_Equal(KErrEof, r); dir.Close(); }
// ----------------------------------------------------------------------------- // CAknFileSelectionModel::ContainsFiles // // ----------------------------------------------------------------------------- // TBool CAknFileSelectionModel::ContainsFiles( const TDesC& aFolder ) { TPath directory( iCurrentPath.DriveAndPath() ); directory.Append( aFolder ); AknCFDUtility::AddTrailingBackslash( directory ); // ignore error RDir dir; TBool ret( EFalse ); if ( dir.Open( iFs, directory, KEntryAttNormal ) != KErrNone ) { return EFalse; } TEntry entry; if ( dir.Read( entry ) == KErrNone ) { ret = ETrue; } dir.Close(); return ret; }