本文整理汇总了C++中TEntry::IsDir方法的典型用法代码示例。如果您正苦于以下问题:C++ TEntry::IsDir方法的具体用法?C++ TEntry::IsDir怎么用?C++ TEntry::IsDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEntry
的用法示例。
在下文中一共展示了TEntry::IsDir方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScanDirectory
void CStateDownload::ScanDirectory(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aFilesArray)
{
TParse parse;
parse.Set(aWild, &aDir, NULL);
TPtrC spec(parse.FullName());
TFindFile FindFile(aFs);
CDir* dir;
if (FindFile.FindWildByPath(parse.FullName(), NULL, dir) == KErrNone)
{
CleanupStack::PushL(dir);
TInt count=dir->Count();
for(TInt i = 0; i < count; i++)
{
parse.Set((*dir)[i].iName, &spec, NULL);
TEntry entry;
if(aFs.Entry(parse.FullName(),entry) == KErrNone)
{
if(!entry.IsDir())
{
//InsertIsqL raises a KErrAlreadyExists (-11) when inserting a duplicate
TRAPD(err,aFilesArray->InsertIsqL(parse.FullName()));
}
}
}
CleanupStack::PopAndDestroy(dir);
}
}
示例2: fillFromTEntry
void QFileSystemMetaData::fillFromTEntry(const TEntry& entry)
{
entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
knownFlagsMask |= QFileSystemMetaData::SymbianTEntryFlags;
//Symbian doesn't have unix type file permissions
entryFlags |= QFileSystemMetaData::ReadPermissions;
if(!entry.IsReadOnly()) {
entryFlags |= QFileSystemMetaData::WritePermissions;
}
//set the type
if(entry.IsDir())
entryFlags |= (QFileSystemMetaData::DirectoryType | QFileSystemMetaData::ExecutePermissions);
else
entryFlags |= QFileSystemMetaData::FileType;
//set the attributes
entryFlags |= QFileSystemMetaData::ExistsAttribute;
if(entry.IsHidden())
entryFlags |= QFileSystemMetaData::HiddenAttribute;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
size_ = entry.FileSize();
#else
size_ = (TUint)(entry.iSize);
#endif
modificationTime_ = entry.iModified;
}
示例3: DeleteFileL
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::DeleteFileL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::DeleteFileL( const TDesC8 &aFileName )
{
RDEBUG("CTerminalControlServer::DeleteFileL");
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL( fs );
HBufC *fileName = HBufC::NewLC( aFileName.Length()+1 );
TPtr fnptr( fileName->Des() );
fnptr.Copy(aFileName);
TEntry entry;
User::LeaveIfError( fs.Entry( fnptr, entry ) );
if( entry.IsDir() )
{
if(fnptr.Right(1) != _L("\\"))
{
fnptr.Append(_L("\\"));
}
User::LeaveIfError(fs.RmDir( fnptr ) );
}
else
{
User::LeaveIfError(fs.Delete( fnptr ) );
}
CleanupStack::PopAndDestroy( fileName );
CleanupStack::PopAndDestroy( &fs );
}
示例4: DeleteFile
TInt CFileEngine::DeleteFile(const TDesC& aPath)
{
TInt returnErr=0;
CDir* dir;
TInt err=iFs.GetDir(aPath,KEntryAttNormal|KEntryAttDir|KEntryAttHidden,ESortByDate,dir);
if(err==KErrNone)
{
TInt tempInt = dir->Count();
for(TInt i = 0;i < tempInt;i++)
{
TEntry iEntry = (*dir)[i];
if(iEntry.IsDir())
{
TInt iLength=iEntry.iName.Length();
if(iLength>0)
{
TFileName filePath;
filePath.Append(aPath);
filePath.Append(iEntry.iName);
filePath.Append(_L("\\"));
DeleteFile(filePath);
}
}
else
{
TFileName filePath;
filePath.Append(aPath);
filePath.Append(iEntry.iName);
returnErr=BaflUtils::DeleteFile(iFs,filePath);
}
}
}
else
{
returnErr=err;
}
if(dir)
{
delete dir;
dir=NULL;
}
returnErr=iFs.RmDir(aPath);
return returnErr;
}
示例5: Delete
// ---------------------------------------------------------------------------
// CRfsFileMan::Delete
// ---------------------------------------------------------------------------
//
TInt CRfsFileMan::Delete( const TDesC& aFullPath, const TEntry& aEntry )
{
FUNC_LOG;
INFO_1( "Delete '%S'", &aFullPath );
TBool isDir( aEntry.IsDir() );
TInt err( isDir ? iFs.RmDir( aFullPath ) : iFs.Delete( aFullPath ) );
if ( err == KErrAccessDenied )
{
ResetAttributes( aFullPath, aEntry );
err = isDir ? iFs.RmDir( aFullPath ) : iFs.Delete( aFullPath );
}
ERROR_1( err, "Failed to delete '%S'", &aFullPath );
return err;
}
示例6: DeleteL
// ---------------------------------------------------------------------------
// CRfsFileMan::DeleteL
// ---------------------------------------------------------------------------
//
void CRfsFileMan::DeleteL( const TDesC& aFullPath, const TEntry& aRootEntry )
{
FUNC_LOG;
if ( aRootEntry.IsDir() )
{
INFO_1( "Checking contents of '%S'", &aFullPath );
HBufC* buffer = HBufC::NewLC( KMaxPath );
TPtr ptr = buffer->Des();
CDirStackEntry::PushDirEntryL( iDirStack, aFullPath, iFs ); // Setup root dir
while ( iDirStack.Count() > 0 )
{
CDirStackEntry& stackEntry = *( iDirStack[ iDirStack.Count() - 1 ] );
const TEntry* dirEntry = stackEntry.GetNextEntry( ptr );
if ( dirEntry )
{
if ( dirEntry->IsDir() )
{
CDirStackEntry::PushDirEntryL( iDirStack, ptr, iFs );
}
else
{
Delete( ptr, *dirEntry );
}
}
else
{
// Dir has been processed. Now it is empty and can be deleted.
stackEntry.FullPath( ptr );
TEntry entry;
if( iFs.Entry( ptr, entry ) == KErrNone )
{
Delete( ptr, entry );
}
CDirStackEntry::PopAndDestroyDirEntry( iDirStack );
}
}
CleanupStack::PopAndDestroy( buffer );
}
else
{
Delete( aFullPath, aRootEntry );
}
}
示例7: ScanDirectoryForSkinFilesL
// ---------------------------------------------------------------------------
// Scan directory for files.
// ---------------------------------------------------------------------------
//
void CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL(
const TDesC& aRootDir )
{
AKNS_TRACE_DEBUG("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL" );
CDirScan *dirScan = CDirScan::NewLC( iFsSession );
dirScan->SetScanDataL(
aRootDir,
KEntryAttNormal | KEntryAttHidden | KEntryAttSystem |
KEntryAttDir,
ESortNone );
// Fetch all directories and files from root.
CDir* entryList = NULL;
TParse parse;
for(;;)
{
TRAPD( err, dirScan->NextL( entryList ) );
// Stop in error case, or if no more data.
if (!entryList || ( err != KErrNone) )
{
break;
}
for (TInt i=0; i < entryList->Count(); i++)
{
TEntry entry = (*entryList)[i];
const TDesC& dir = dirScan->FullPath();
parse.Set( entry.iName, &dir, NULL );
if ( !entry.IsDir() )
{
iFileArray.Append( parse );
}
}
delete entryList;
}
AKNS_TRACE_DEBUG1("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL noFiles=%d", iFileArray.Count() );
// Destroy the list.
CleanupStack::PopAndDestroy( dirScan );
}
示例8: FormatEntry
void FormatEntry(TDes& aBuffer, const TEntry& aEntry)
{
_LIT(KEntryDetails,"Entry details: ");
_LIT(KReadOnly," Read-only");
_LIT(KHidden," Hidden");
_LIT(KSystem," System");
_LIT(KDirectory," Directory");
_LIT(KArchive," Archive");
_LIT(KNewLIne,"\n");
aBuffer.Append(KEntryDetails);
if(aEntry.IsReadOnly())
aBuffer.Append(KReadOnly);
if(aEntry.IsHidden())
aBuffer.Append(KHidden);
if(aEntry.IsSystem())
aBuffer.Append(KSystem);
if(aEntry.IsDir())
aBuffer.Append(KDirectory);
if(aEntry.IsArchive())
aBuffer.Append(KArchive);
aBuffer.Append(KNewLIne);
}
示例9: GetFileType
void CImageReader::GetFileType(const TDesC& aFileName, TDes8& aFileType)
{
TEntry FileEntry;
if(CCoeEnv::Static()->FsSession().Entry(aFileName,FileEntry) == KErrNone)
{
TBuf8<255> FileBuffer;
if(!FileEntry.IsDir())
{
TInt FileSize = FileEntry.iSize;
if(FileSize > 255)
{
FileSize = 255;
}
if(CCoeEnv::Static()->FsSession().ReadFileSection(aFileName,0,FileBuffer,FileSize) == KErrNone)
{
RApaLsSession RSession;
if(RSession.Connect() == KErrNone)
{
TDataRecognitionResult FileDataType;
RSession.RecognizeData(aFileName,FileBuffer,*&FileDataType);
// if(FileDataType.iConfidence > aResult.iConfidence)
// {
aFileType.Copy(FileDataType.iDataType.Des8());
// }
RSession.Close();
}
}
}
}
}
示例10: IntegrityDeleteFileL
void IntegrityDeleteFileL(const TDesC& aPath, CIntegrityTreeLeaf* aLeaf, RFs& aFs,
RLoader& aLoader, CFileMan& aFileMan)
{
_LIT(KSysBin, "\\sys\\bin");
RBuf name;
name.CreateL(aPath, KMaxFileName);
CleanupClosePushL(name);
name.Append(aLeaf->Name());
TEntry entry;
TInt err = aFs.Entry(name, entry);
if (err == KErrNone)
{
aFs.SetAtt(name, 0, KEntryAttReadOnly);
if(entry.IsDir())
{
// Make sure to append slash before calling RmDir - otherwise it deletes the parent directory
if (name[name.Length()-1] != KPathDelimiter)
{
name.Append(KPathDelimiter);
}
User::LeaveIfError(aFileMan.RmDir(name));
}
else
{
if ( aLeaf->Type() == EBackupFile ) // Implies a commit operation is in progress
{
if ( IsBinary(entry) )
{
// Forming the file name so the renamed file can be under sys/bin
// for special delete mechanism using RLoader::Delete
RBuf tmpName;
TParsePtrC fileName(name);
tmpName.CreateL(name.Length() + KSysBin.iTypeLength);
CleanupClosePushL(tmpName);
tmpName.Append(fileName.Drive());
tmpName.Append(KSysBin);
tmpName.Append(fileName.Path());
tmpName.Append(fileName.NameAndExt());
DEBUG_PRINTF3(_L("Integrity Services - Renaming %S to %S"), &name, &tmpName);
aFileMan.Rename(name,tmpName,CFileMan::EOverWrite);
User::LeaveIfError(aLoader.Delete(tmpName)); // Using RLoader delete for paged binaries
DEBUG_PRINTF2(_L("Integrity Services - Deleted renamed file %S"), &tmpName);
// prune the directory tree if possible
RemoveDirectoryTreeL(aFs, tmpName);
CleanupStack::PopAndDestroy(&tmpName);
}
else
{
User::LeaveIfError(aFileMan.Delete(name));
}
}
else
{
// Need to use RLoader Delete which can be used during deletion of Added files during Rollback
User::LeaveIfError(aLoader.Delete(name));
}
}
// prune the directory tree if possible
RemoveDirectoryTreeL(aFs, name);
}
else if(err != KErrNotFound && err != KErrPathNotFound)
{
DEBUG_PRINTF3(_L("Integrity Services - error %d removing %S"), err, &name);
User::Leave(err);
}
else
{
DEBUG_PRINTF3(_L("Integrity Services - error %d removing %S"), err, &name);
// Check for any renamed files to move it to sys/bin for special delete mechanism
RBuf tmpName;
TParsePtrC fileName(name);
tmpName.CreateL(name.Length() + KSysBin.iTypeLength);
CleanupClosePushL(tmpName);
tmpName.Append(fileName.Drive());
tmpName.Append(KSysBin);
tmpName.Append(fileName.Path());
tmpName.Append(fileName.NameAndExt());
DEBUG_PRINTF2(_L("Integrity Services - Removing %S renamed binary files if any"), &tmpName);
aLoader.Delete(tmpName);
// prune the directory tree if possible
RemoveDirectoryTreeL(aFs, tmpName);
CleanupStack::PopAndDestroy(&tmpName);
}
CleanupStack::PopAndDestroy(&name);
}
示例11: ServiceL
void CTestUtilSessionSwi::ServiceL(const RMessage2& aMessage)
{
switch (aMessage.Function())
{
case ECopy:
{
HBufC* source = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0);
HBufC* destination = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,1);
TInt err = Server().FileMan().Copy(*source, *destination, CFileMan::ERecurse | CFileMan::EOverWrite);
if (err == KErrNone)
{
// Turn off the read only attributes
TTime time(0); // must specify 0, or a valid time, otherwise sets time to a random value and causes -6/-21 errors
err = Server().FileMan().Attribs(*destination, 0, KEntryAttReadOnly, time, CFileMan::ERecurse);
}
CleanupStack::PopAndDestroy(destination);
CleanupStack::PopAndDestroy(source);
aMessage.Complete(err);
break;
}
case EMove:
{
HBufC* source = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0);
HBufC* destination = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,1);
TInt err = Server().FS().Rename(*source,*destination);
if (err == KErrNone)
{
// Turn off the read only attributes
TTime time(0); // must specify 0, or a valid time, otherwise sets time to a random value and causes -6/-21 errors
err = Server().FileMan().Attribs(*destination, 0, KEntryAttReadOnly, time, CFileMan::ERecurse);
}
CleanupStack::PopAndDestroy(destination);
CleanupStack::PopAndDestroy(source);
aMessage.Complete(err);
break;
}
case EDelete:
{
HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0);
TEntry entry;
TInt err = Server().FS().Entry(*fileName, entry);
if (err == KErrNone)
{
if (entry.IsDir())
{
TPath pathName(*fileName);
if (pathName[pathName.Length() - 1] != KPathDelimiter)
{
pathName.Append(KPathDelimiter);
}
err = Server().FileMan().RmDir(pathName);
}
else
{
err = Server().FS().Delete(*fileName);
}
}
CleanupStack::PopAndDestroy(fileName);
aMessage.Complete(err);
break;
}
case ERmDir:
{
HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0);
TParsePtrC parsePtr(*fileName);
if(parsePtr.IsRoot())
{
User::Leave(KErrAccessDenied);
}
TInt err = Server().FileMan().RmDir(*fileName);
CleanupStack::PopAndDestroy(fileName);
aMessage.Complete(err);
break;
}
case EMkDirAll:
{
HBufC* fileName = CTestUtilSessionCommon::AllocateInputBufferLC(aMessage,0);
TInt err = Server().FS().MkDirAll(*fileName);
CleanupStack::PopAndDestroy(fileName);
aMessage.Complete(err);
break;
}
case EFileExists:
{
delete iDetector;
iDetector=CTestFileDetector::NewL(aMessage,
Server().FS());
iDetector->DetectFile();
break;
}
case ELock:
//.........这里部分代码省略.........
示例12: UpdateItemListL
// -----------------------------------------------------------------------------
// CAknFileSelectionModel::UpdateItemListL
// -----------------------------------------------------------------------------
//
TInt CAknFileSelectionModel::UpdateItemListL()
{
iEntryArray->Reset();
iImageIndexArray.Reset();
CDir* entryArray = ReadDirectory( iCurrentPath.DriveAndPath() );
if ( !entryArray )
{
return KErrNotFound;
}
CleanupStack::PushL( entryArray );
TInt itemCount( entryArray->Count() );
if ( itemCount > 0 )
{
TInt filterCount( iFilterArray->Count() );
TInt filterIndex;
TBool accepted;
CDesC16Array* desC16FoldersArray = new ( ELeave )
CDesC16ArrayFlat( KEntryArrayGranularity );
CleanupStack::PushL( desC16FoldersArray );
CDesC16Array* desC16FilesArray = new ( ELeave )
CDesC16ArrayFlat( KEntryArrayGranularity );
CleanupStack::PushL( desC16FilesArray );
CArrayPakFlat<TEntry>* tmpFoldersArray = new( ELeave )
CArrayPakFlat<TEntry>( KEntryArrayGranularity );
CleanupStack::PushL( tmpFoldersArray );
CArrayPakFlat<TEntry>* tmpFilesArray = new( ELeave )
CArrayPakFlat<TEntry>( KEntryArrayGranularity );
CleanupStack::PushL( tmpFilesArray );
tmpFoldersArray->Reset();
desC16FoldersArray->Reset();
tmpFilesArray->Reset();
desC16FilesArray->Reset();
for ( TInt i( 0 ); i < itemCount; i++ ) // Generate filtered list
{
accepted = ETrue; // If there are no filters, accept the entry
TEntry entry = ( *entryArray )[i];
filterIndex = 0;
// Go thru the filters while the entry is accepted
while( ( filterIndex < filterCount ) && ( accepted ) )
{
accepted = iFilterArray->At( filterIndex )->Accept(
iCurrentPath.DriveAndPath(), entry );
filterIndex++;
}
if ( accepted ) // Directory entry has passed all filters
{
// Add filename to filtered list
if ( entry.IsDir() )
{
desC16FoldersArray->AppendL( GetLocalizedName( entry.iName ) );
tmpFoldersArray->AppendL( entry, sizeof( TEntry ) );
}
else
{
desC16FilesArray->AppendL( GetLocalizedName( entry.iName ) );
tmpFilesArray->AppendL( entry, sizeof( TEntry ) );
}
}
}
TInt entryCount = 0;
TInt index;
TKeyArrayPak key( _FOFF( TEntry, iName ), ECmpCollated );
// Add folder entries
desC16FoldersArray->Sort( ECmpCollated );
entryCount = desC16FoldersArray->MdcaCount();
for( TInt j( 0 ); j < entryCount; j++ )
{
for( TInt k( 0 ); k < entryCount; k++ )
{
if( ( *desC16FoldersArray )[j] ==
GetLocalizedName( ( *tmpFoldersArray )[k].iName ) &&
iEntryArray->Find( ( *tmpFoldersArray )[k], key, index ) != 0 )
{
TEntry tmpEntry = ( *tmpFoldersArray )[k];
iEntryArray->AppendL( tmpEntry, sizeof( TEntry ) );
// Entry is a directory
TFileTypeIcon folderIcon( EFolderIcon );
if( !AknCFDUtility::IsRemoteDrive( iCurrentPath.Drive() ) )
{
if ( ContainsSubfolders( tmpEntry.iName ) )
{
folderIcon = ESubFolderIcon;
}
else if ( !ContainsFiles( tmpEntry.iName ) )
{
folderIcon = EFolderEmptyIcon;
}
//.........这里部分代码省略.........