TBool WidgetUnzipUtilityS60::RunUnzipL() { CZipFileMember* member = iMembers->NextL(); if (member) { CleanupStack::PushL(member); RZipFileMemberReaderStream* stream; User::LeaveIfError(iZipFile->GetInputStreamL(member, stream)); CleanupStack::PushL(stream); HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize()); TPtr8 bufferPtr(buffer->Des()); User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize())); TFileName text; text.Copy(*iTempZipPath); text.Append(_L('\\')); text.Append(*member->Name()); HBufC* zipedFileNameAndPath = text.AllocLC(); TInt index = zipedFileNameAndPath->LocateReverse('\\'); if (index >= 0) { TPtrC path = zipedFileNameAndPath->Left(index + 1); iFs.MkDirAll(path); // errors are ok } if (zipedFileNameAndPath->Right(1).Compare(_L('\\')) != 0) { RFile file; CleanupClosePushL(file); file.Replace(iFs,*zipedFileNameAndPath,EFileWrite); User::LeaveIfError(file.Write(*buffer)); CleanupStack::PopAndDestroy(); // file } iUncompressedSize += member->UncompressedSize(); CleanupStack::PopAndDestroy(4); return ETrue; } else { return EFalse; } }
HBufC* CMemSpyEngineFileHolder::CleanContextInfoLC( const TDesC& aContext ) { TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - START - %S"), &aContext ) ); TFileName fileName; TBool seenDoubleColon = EFalse; const TInt length = aContext.Length(); for( TInt i=0; i<length; i++ ) { const TChar c( aContext[ i ] ); const TBool haveNextChar = ( i+1 < length ); // //TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - c[%03d]: \'%c\', haveNextChar: %d, seenDoubleColon: %d"), i, (TUint32) c, haveNextChar, seenDoubleColon ) ); // if ( c == ':' && haveNextChar && aContext[ i + 1 ] == ':' ) { // Skip double colon i++; fileName.Append( '-' ); seenDoubleColon = ETrue; } else if ( c == '.' ) { if ( seenDoubleColon ) { break; } else { fileName.Append( '-' ); } } else { fileName.Append( c ); } } TRACE( RDebug::Print( _L("CMemSpyEngineFileHolder::CleanContextInfoLC() - END - %S"), &fileName ) ); return fileName.AllocLC(); }
/* ------------------------------------------------------------------------------- Class: CStifFileParser Method: ConstructL Description: Symbian OS second phase constructor Symbian OS default constructor can leave. Sets variables. Parameters: RFs& aFs: in: Handle to valid file server RFile& aFile: in: Handle to the source file TBool aIsUnicode in: Is file in unicode format Return Values: None Errors/Exceptions: None Status: Proposal ------------------------------------------------------------------------------- */ void CStifFileParser::ConstructL(RFs& aFs, RFile& aFile, TBool aIsUnicode) { //Initialization iFileServer = aFs; iBaseFile = aFile; iCurrentFile = &aFile; iIsUnicode = aIsUnicode; iBytesPerChar = iIsUnicode ? 2 : 1; //Create file stack (INCLUDE feature) iFileStack = new (ELeave) CStackDeprecated<RFile, EFalse>; //Add base file to file names array TFileName fn; iCurrentFile->FullName(fn); HBufC* newFile = fn.AllocLC(); User::LeaveIfError(iFileNames.Append(newFile)); CleanupStack::Pop(newFile); }
HBufC* CMemSpyEngineFileHolder::GenerateFileNameLC( const TDriveNumber* aForceDrive ) { TFileName name; MemSpyEngineUtils::GetFolderL( FsSession(), name, *iMetaData, aForceDrive ); return name.AllocLC(); }