本文整理汇总了C++中TEntry类的典型用法代码示例。如果您正苦于以下问题:C++ TEntry类的具体用法?C++ TEntry怎么用?C++ TEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OstTraceFunctionEntry0
/**
Check if we can move the file to the new location
*/
TMTPResponseCode CMTPMoveObject::CanMoveObjectL(const TDesC& aOldName, const TDesC& aNewName) const
{
OstTraceFunctionEntry0( CMTPMOVEOBJECT_CANMOVEOBJECTL_ENTRY );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
OstTraceExt1( TRACE_ERROR, DUP1_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get entry details from %S", aOldName));
TInt drive(iFramework.StorageMgr().DriveNumber(iStorageId));
LEAVEIFERROR(drive,
OstTrace1( TRACE_ERROR, DUP2_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get driver number for storage %d", iStorageId));
TVolumeInfo volumeInfo;
LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
OstTrace1( TRACE_ERROR, DUP3_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get volume info for drive %d", drive));
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
if(volumeInfo.iFree < fileEntry.FileSize())
#else
if(volumeInfo.iFree < fileEntry.iSize)
#endif
{
result = EMTPRespCodeStoreFull;
}
else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))
{
result = EMTPRespCodeInvalidParentObject;
}
OstTraceFunctionExit0( CMTPMOVEOBJECT_CANMOVEOBJECTL_EXIT );
OstTrace1( TRACE_NORMAL, CMTPMOVEOBJECT_CANMOVEOBJECTL, "response code 0x%04X", result );
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:34,代码来源:cmtpmoveobject.cpp
示例2: spec
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);
}
}
开发者ID:BwRy,项目名称:core-symbian,代码行数:30,代码来源:StateDownload.cpp
示例3: OstTraceFunctionEntry0
/**
Check if we can copy the file to the new location
*/
TMTPResponseCode CMTPImageDpCopyObject::CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const
{
OstTraceFunctionEntry0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_ENTRY );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
OstTraceExt2( TRACE_ERROR, DUP1_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets the entry details for %S failed! error code %d", aOldName, munged_err ));
TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
LEAVEIFERROR(drive,
OstTraceExt2( TRACE_ERROR, DUP2_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets drive for storage %d failed! error code %d", iStorageId, munged_err ));
TVolumeInfo volumeInfo;
LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
OstTraceExt2( TRACE_ERROR, DUP3_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets volume information for driver %d failed! error code %d", drive, munged_err ));
if(volumeInfo.iFree < fileEntry.FileSize())
{
result = EMTPRespCodeStoreFull;
}
else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))
{
result = EMTPRespCodeInvalidParentObject;
}
OstTrace1( TRACE_NORMAL, CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"CanCopyObjectL - Exit with response code 0x%04X", result );
OstTraceFunctionExit0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_EXIT );
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:34,代码来源:cmtpimagedpcopyobject.cpp
示例4: PRINT
// -----------------------------------------------------------------------------
// CGetPartialObject::VerifyParametersL
// Verify if the parameter of the request (i.e. offset) is good.
// -----------------------------------------------------------------------------
//
TBool CGetPartialObject::VerifyParametersL()
{
PRINT( _L( "MM MTP => CGetPartialObject::VerifyParametersL" ) );
__ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) );
TBool result = EFalse;
iObjectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 );
iOffset = Request().Uint32( TMTPTypeRequest::ERequestParameter2 );
iPartialDataLength = Request().Uint32( TMTPTypeRequest::ERequestParameter3 );
PRINT3( _L( "MM MTP <> CGetPartialObject::VerifyParametersL iObjectHandle = 0x%x, iOffset = 0x%x, iMaxLength = 0x%x " ),
iObjectHandle,
iOffset,
iPartialDataLength );
//get object info, but do not have the ownship of the object
CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( iObjectHandle );
__ASSERT_DEBUG( objectInfo, Panic( EMmMTPDpObjectNull ) );
const TDesC& suid( objectInfo->DesC( CMTPObjectMetaData::ESuid ) );
PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL suid = %S" ), &suid );
TEntry fileEntry;
User::LeaveIfError( iFramework.Fs().Entry( suid, fileEntry ) );
if ( iOffset < fileEntry.FileSize() )
{
result = ETrue;
}
PRINT1( _L( "MM MTP <= CGetPartialObject::VerifyParametersL result = %d" ), result );
return result;
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:37,代码来源:cgetpartialobject.cpp
示例5: 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;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:28,代码来源:qfilesystemengine_symbian.cpp
示例6: RDEBUG
// ----------------------------------------------------------------------------------------
// 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 );
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:36,代码来源:TerminalControlServer.cpp
示例7: 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;
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:50,代码来源:FileEngine.cpp
示例8: PRINT2
// -----------------------------------------------------------------------------
// CMoveObject::CanMoveObjectL
// Check if we can move the file to the new location
// -----------------------------------------------------------------------------
//
TMTPResponseCode CMoveObject::CanMoveObjectL( const TDesC& aOldName,
const TDesC& aNewName ) const
{
PRINT2( _L( "MM MTP => CMoveObject::CanMoveObjectL aOldName = %S, aNewName = %S" ),
&aOldName,
&aNewName );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
User::LeaveIfError( iFramework.Fs().Entry( aOldName, fileEntry ) );
TInt drive = iFramework.StorageMgr().DriveNumber( iStorageId );
User::LeaveIfError( drive );
TVolumeInfo volumeInfo;
User::LeaveIfError( iFramework.Fs().Volume( volumeInfo, drive ) );
if ( volumeInfo.iFree < fileEntry.FileSize() )
{
result = EMTPRespCodeStoreFull;
}
else if ( BaflUtils::FileExists( iFramework.Fs(), aNewName ) )
{
#ifdef MMMTPDP_REPLACE_EXIST_FILE
// delete the old one and replace
TInt delErr = iFramework.Fs().Delete( aNewName );
PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL delErr = %d" ), delErr );
// delete from the metadata DB
TRAPD( err, iFramework.ObjectMgr().RemoveObjectL( aNewName ) );
PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL err = %d" ), err );
// delete from video/mpx DB
CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo
if ( iFramework.ObjectMgr().ObjectL( aNewName, *objectInfo ) )
{
TRAP( err, iDpConfig.GetWrapperL().DeleteObjectL( aNewName,
objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) );
}
CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo
if ( err )
{
// do nothing
}
#else
result = EMTPRespCodeInvalidParentObject;
#endif
}
PRINT1( _L( "MM MTP <= CMoveObject::CanMoveObjectL result = 0x%x" ), result );
return result;
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:53,代码来源:cmoveobject.cpp
示例9: Test3
LOCAL_C void Test3()
//
// Test RFs::Entry()
//
{
test.Next(_L("Use RFs::EntryL() to check files"));
TEntry entry;
TInt r=TheFs.Entry(_L("UIDCHKNO.SHT"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHKNO.SHT"));
test(entry.IsTypeValid()==EFalse);
r=TheFs.Entry(_L("UIDCHKNO.LNG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHKNO.LNG"));
test(entry.IsTypeValid()==EFalse);
r=TheFs.Entry(_L("UIDCHK.MSG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.MSG"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('X') && entry.iType[1]==TUid::Uid('Y') && entry.iType[2]==TUid::Uid('Z'));
r=TheFs.Entry(_L("UIDCHK.BLG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.BLG"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('U') && entry.iType[1]==TUid::Uid('I') && entry.iType[2]==TUid::Uid('D'));
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.DAT"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
r=TheFs.Entry(_L("UIDWINS.PE"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDWINS.PE"));
#if defined(__WINS__)
TFileName sessionPath;
TheFs.SessionPath(sessionPath);
if (sessionPath[0]!='C')
test(entry.IsTypeValid()==EFalse);
else
{
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid(0x1000007a) && entry.iType[1]==TUid::Uid(2) && entry.iType[2]==TUid::Uid(3));
}
#else
test(entry.IsTypeValid()==EFalse);
#endif
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:53,代码来源:t_chkuid.cpp
示例10: ResetAttributes
// ---------------------------------------------------------------------------
// CRfsFileMan::ResetAttributes
// ---------------------------------------------------------------------------
//
void CRfsFileMan::ResetAttributes( const TDesC& aFullPath, const TEntry& aEntry )
{
FUNC_LOG;
if ( aEntry.IsReadOnly() )
{
TInt err = iFs.SetEntry(
aFullPath, aEntry.iModified, 0, KEntryAttReadOnly | KEntryAttHidden );
ERROR( err, "Failed to reset attributes" );
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:15,代码来源:rfsfileman.cpp
示例11: AKNS_TRACE_DEBUG
// ---------------------------------------------------------------------------
// 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 );
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:45,代码来源:aknssrvactivebackupdataclient.cpp
示例12: 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);
}
开发者ID:huellif,项目名称:symbian-example,代码行数:22,代码来源:Attributes.cpp
示例13: 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();
}
}
}
}
}
开发者ID:flaithbheartaigh,项目名称:symbianmapnavi,代码行数:37,代码来源:mapimageengine.cpp
示例14: OstTraceFunctionEntry0
/**
Check the GetPartialObject reqeust
@return EMTPRespCodeOK if the request is good, otherwise, one of the error response codes
*/
TMTPResponseCode CMTPGetPartialObject::CheckRequestL()
{
OstTraceFunctionEntry0( CMTPGETPARTIALOBJECT_CHECKREQUESTL_ENTRY );
TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL();
if(result == EMTPRespCodeOK)
{
TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
iOffset = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
iLength = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
//does not take ownership
iObjectInfo = iRequestChecker->GetObjectInfo(objectHandle);
if (!iObjectInfo)
{
// The object handle has already been checked, so an invalid handle can
// only occur if it was invalidated during a context switch between
// the validation time and now.
result = EMTPRespCodeInvalidObjectHandle;
}
else
{
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry),
OstTraceExt1(TRACE_ERROR, CMTPGETPARTIALOBJECT_CHECKREQUESTL,
"can't get entry details for %S!", iObjectInfo->DesC(CMTPObjectMetaData::ESuid)));
if((iOffset >= fileEntry.FileSize()))
{
result = EMTPRespCodeInvalidParameter;
}
}
}
OstTraceFunctionExit0( CMTPGETPARTIALOBJECT_CHECKREQUESTL_EXIT );
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:40,代码来源:cmtpgetpartialobject.cpp
示例15: 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;
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:19,代码来源:rfsfileman.cpp
示例16: INFO_1
// ---------------------------------------------------------------------------
// 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 );
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:51,代码来源:rfsfileman.cpp
示例17: 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);
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:96,代码来源:operationfunctions.cpp
示例18: Compare
TInt CMdSNotifier::Compare( const TEntry& aFirst, const TEntry& aSecond )
{
return aFirst.Id() - aSecond.Id();
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:4,代码来源:mdsnotifier.cpp
示例19: switch
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:
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:testutilsessionswi.cpp
示例20: Request
/**
Verify request
*/
TMTPResponseCode CMTPSetObjectPropValue::CheckRequestL()
{
TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
TUint32 handle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
CMTPObjectMetaData* meta = iRequestChecker->GetObjectInfo(handle);
__ASSERT_DEBUG(meta, Panic(EMTPDpObjectNull));
if(!iSingleton.StorageMgr().IsReadWriteStorage(meta->Uint(CMTPObjectMetaData::EStorageId)))
{
responseCode = EMTPRespCodeAccessDenied;
}
if(responseCode == EMTPRespCodeOK)
{
TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
if(propCode != EMTPObjectPropCodeAssociationType && propCode != EMTPObjectPropCodeAssociationDesc)
{
const TInt count = sizeof(KMTPDpSupportedProperties) / sizeof(TUint16);
TInt i = 0;
for(i = 0; i < count; i++)
{
if(KMTPDpSupportedProperties[i] == propCode
&& IsPropCodeReadonly(propCode))
// Object property code supported, but cann't be set.
{
responseCode = EMTPRespCodeAccessDenied;
break;
}
else if(KMTPDpSupportedProperties[i] == propCode)
// Object property code supported and can be set.
{
break;
}
}
if(i == count)
{
responseCode = EMTPRespCodeInvalidObjectPropCode;
}
}
else if(meta->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeAssociation)
{
responseCode = EMTPRespCodeInvalidObjectFormatCode;
}
}
else
{
const TDesC& suid(meta->DesC(CMTPObjectMetaData::ESuid));
TEntry entry;
LEAVEIFERROR( iFramework.Fs().Entry(suid, entry),
OstTraceExt1( TRACE_ERROR, CMTPSETOBJECTPROPVALUE_CHECKREQUESTL, "Gets entry details for %S failed!", suid));
//According to spec, there are 4 statuses: No Protection; Read-only; Read-only data; Non-transferrable data
//Currently, we only use FS's Read-only attribute to support No Protection and Read-only statuses.
//so if the attribute is read-only, we will return EMTPRespCodeAccessDenied.
if (entry.IsReadOnly())
{
responseCode = EMTPRespCodeAccessDenied;
}
}
return responseCode;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:66,代码来源:cmtpsetobjectpropvalue.cpp
注:本文中的TEntry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论