CGameSprite::CGameSprite(CGame* game, TPtrC filename, const CGameRect& r, TUint32 num)
{
	this->game = game;
	this->layer = 0;
	this->size = r;
	
	//printf("Largura e altura: %d %d\n", size.w, size.h);

	RFs fsSession;
	User::LeaveIfError(fsSession.Connect());
	CleanupClosePushL( fsSession );
	TFileName name, path;
	name.Append(_L("c:"));
	fsSession.PrivatePath( path );
	name.Append( path );
	name.Append( filename );
		
	CFbsBitmap *iBitmap = new (ELeave) CFbsBitmap;
	
	CGameSpriteFrame* frame;
	
	for(TUint32 i = 0; i<num; i++){
		frame = new CGameSpriteFrame(name, i, r, iBitmap);
		this->frames.Append(frame);
	}
		    
	delete iBitmap;

}
// -----------------------------------------------------------------------------
// CSisxUIStartupFile::ClearAllNewFiles
// Deletes all resource files from import directory.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CSisxUIStartupFile::ClearAllNewFiles()
    {
    TInt result( KErrNone );
    RFs fileSess;
    CFileMan* fileMan = NULL;
    
    result = fileSess.Connect();
    if ( result == KErrNone )
        {
        TRAP( result, fileMan = CFileMan::NewL( fileSess ) );
        }
    
    if ( result == KErrNone )
        {  
        TFileName resFile;
        fileSess.PrivatePath( resFile );
        resFile.Insert( 0, TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
        resFile.Append( KImportDir );      
        resFile.Append( KNewFileMatch ); 
        fileMan->Delete( resFile );
        }
    
    delete fileMan;    
    fileSess.Close();
    
    return result;
    }
void CQualityProfileApi_ProfileReadStep::InitializeQualityProfileInfoL()
	{
	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);

	TBuf<32> privatePath;
	User::LeaveIfError(fs.PrivatePath(privatePath));

	TParse parse;
	parse.Set(privatePath, NULL, NULL);
	parse.AddDir(KLbsDir);
	
	RArray<TQualityProfile> qualityArray;
	CleanupClosePushL(qualityArray);
	
	qualityArray.Reserve(5);

	// Only want to use the first file that is found.
	// The way TFindFile::FindByDir works, it will search
	// C: and D: before Z:, which is what we want.
	TFindFile findFile(fs);
	TInt err = findFile.FindByDir(KQualityProfileIniName, parse.Path());
	if (err == KErrNone)
		{
		GetQualityProfileInfoL(fs, qualityArray, findFile.File());
		}
	
	// Publish the quality profile info
	LbsQualityProfile::InitializeL(qualityArray);
	
	CleanupStack::PopAndDestroy(&qualityArray);
	CleanupStack::PopAndDestroy(&fs);
	}
// -----------------------------------------------------------------------------
// DataFileL
// return data filename as a TParse
// -----------------------------------------------------------------------------
//
LOCAL_C TParse DataFileL(RFs& aFs)
    {
    TBuf<256> path;
    TParse p;
    User::LeaveIfError(aFs.PrivatePath(path));

#ifndef RD_MULTIPLE_DRIVE

    p.Set(KHelperServerDataStorage,&path,NULL);

#else //RD_MULTIPLE_DRIVE

    TInt driveNumber( -1 );
    TChar driveLetter;
    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
    aFs.DriveToChar( driveNumber, driveLetter );

    TFileName helperServerDataStorage;
    helperServerDataStorage.Format(
                    KHelperServerDataStorage, (TUint)driveLetter );

    p.Set( helperServerDataStorage, &path, NULL );

#endif

    return p;
    }
Esempio n. 5
0
void CMdSServer::CheckInitSriptL()
    {
    RFs fs;
    User::LeaveIfError( fs.Connect() );
    CleanupClosePushL( fs );
    
    TBuf<KMaxFileName> privatePath;
    TBuf<KMaxFileName> schema;
    TBuf<KMaxFileName> defaultImportProfile;
    TBuf<KMaxFileName> backupRegistration;
    RFileReadStream tmpFile;
    
    fs.PrivatePath( privatePath );
    
    schema.Copy( privatePath );
    schema.Append( KSchema );
    
    defaultImportProfile.Copy( privatePath );
    defaultImportProfile.Append( KDefaultImportProfile );
    
    backupRegistration.Copy( privatePath );
    backupRegistration.Append( KBackupRegistration );
    
    CFileMan* fileMan = CFileMan::NewL( fs );
    CleanupStack::PushL( fileMan );
    
    CheckAndInitializeFileL( fs, schema, KSchemaPath(), tmpFile, fileMan );
    
    CheckAndInitializeFileL( fs, defaultImportProfile, KDefaultImportProfilePath(), tmpFile, fileMan );    
    
    CheckAndInitializeFileL( fs, backupRegistration, KBackupRegistrationPath(), tmpFile, fileMan );

    CleanupStack::PopAndDestroy( 2 ); //fileman, fs
    }
TInt CSenBaseIdentityManager::WriteConfigurationToL( const TDesC& aFile )
    {
    // First, collect everything into MEMORY
    CBufFlat *pBuf = CBufFlat::NewL(KFLATBUF_SIZE);
    CleanupStack::PushL(pBuf);

    RBufWriteStream bufWs(*pBuf);
    CleanupClosePushL(bufWs);

    bufWs.WriteL(KUsersStart);

    if(iIdentity)
        {
        iIdentity->WriteAsXMLToL(bufWs);
        }

    bufWs.WriteL(KUsersEnd);

    TPtrC8 p8 = pBuf->Ptr(0);

    CleanupStack::PopAndDestroy(1); // bufWs

    // Everything in MEMORY ok, prepare to write into file
    RFs fss;
    User::LeaveIfError(fss.Connect());
    CleanupClosePushL(fss);

    RFileWriteStream fileOutStream;
    CleanupClosePushL(fileOutStream);


    if(!SysUtil::FFSSpaceBelowCriticalLevelL(&fss, p8.Length()) )
        {
        // note, this will zero-length the file(!)
        // it is better to require that 2xfilesize is available and not to
        // dangerously zero the old file and find out
        // that there is no space left..

        //Data caging 2 implementation
#if defined( EKA2 ) || defined( RD_SECURE_PRIV_DATA )
        TBuf<KMaxPath> file;
        fss.CreatePrivatePath(EDriveC);
        fss.PrivatePath(file);
        file.Append(aFile);
        fileOutStream.Replace(fss, file, EFileWrite);
#else
        fileOutStream.Replace(fss, aFile, EFileWrite);
#endif
        // finally write the UTF-8 into the file. 
        fileOutStream.WriteL(p8);
        }

    CleanupStack::PopAndDestroy(3); // fileOutStream, fss, pBuf

    return KErrNone;
    }
Esempio n. 7
0
// ---------------------------------------------------------------------------
// CGbaServer::MakePrivateFilenameL()
// ---------------------------------------------------------------------------
//
void CGbaServer::MakePrivateFilenameL(RFs& aFs, const TDesC& aLeafName,
                                      TDes& aNameOut) const
{
    aNameOut.Copy(KGBAStoreStandardDrive);
    // Get private path
    TBuf<KPrivateFilepathLength> privatePath;
    aFs.PrivatePath(privatePath);
    aNameOut.Append(privatePath);
    aNameOut.Append(aLeafName);
}
void CEmTubePlaylistManager::ImportPlaylistsL()
	{
	TFileName fileName;
	RFile file;
	RFs session;
	session.Connect();
	CleanupClosePushL( session );

#ifndef __WINS__
	TParsePtrC parse( CEikonEnv::Static()->EikAppUi()->Application()->AppFullName() );
	fileName.Copy( parse.Drive() );
	TPath privateDir;
	User::LeaveIfError( session.PrivatePath( privateDir ) );
	fileName.Append( privateDir );
#else
	fileName.Copy( _L("C:\\Data\\") );
#endif

	fileName.Append( KPlaylistsFilename );

	TInt err = file.Open( session, fileName, EFileStream | EFileRead );
	CleanupClosePushL( file );

	if( err == KErrNone )
		{
		RFileReadStream stream( file );
		CleanupClosePushL( stream );

		TInt count = stream.ReadInt32L();
		for( TInt i=0;i<count;i++)
			{
			CEmTubePlaylist *pl = CEmTubePlaylist::NewL( stream );
			iPlaylists.Append( pl );
			}
		CleanupStack::PopAndDestroy( &stream );
		}

	if( iPlaylists.Count() == 0 )
		{
		HBufC* name = StringLoader::LoadLC( R_PLAYLIST_MOST_PLAYED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );

		name = StringLoader::LoadLC( R_PLAYLIST_RECENTLY_PLAYED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );

		name = StringLoader::LoadLC( R_PLAYLIST_RECENTLY_SAVED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );
		}

	CleanupStack::PopAndDestroy( &file );
	CleanupStack::PopAndDestroy( &session );
	}
TPolicyID RSecMgrSession::UpdatePolicy(TPolicyID aPolicyID,
		const TDesC8& aPolicyBuffer)
	{
	TInt ret(ErrInvalidParameters);
	if(0==aPolicyBuffer.CompareC(KNullDesC8))
		{
		return ret;
		}
		
		TFileName tempDirPath;
		TFileName tempPath;
	
		{
		RFs fileSession;
		if ( KErrNone==fileSession.Connect ())
			{
			fileSession.PrivatePath (tempDirPath);
			BaflUtils::EnsurePathExistsL (fileSession, tempDirPath);

			RFile secPolicyFile;
			secPolicyFile.Temp (fileSession, tempDirPath, tempPath, EFileWrite);
			secPolicyFile.Write(aPolicyBuffer);
			secPolicyFile.Close();			
			}		
		fileSession.Close();
		}
		
	RFs fileSession;
	if ( KErrNone==fileSession.Connect ())
		{
		CleanupClosePushL (fileSession);
		if ( KErrNone==fileSession.ShareProtected ())
			{
			RFile secPolicyFile;
					
			if(KErrNone == secPolicyFile.Open(fileSession,tempPath,EFileRead))
				{
				
				ret = UpdatePolicy (aPolicyID, secPolicyFile);
			
				secPolicyFile.Close();
			
				}

			fileSession.Delete (tempPath);
			}
		
		CleanupStack::PopAndDestroy (&fileSession);//fileSession
		}

	fileSession.Close();
	
	return ret;
	}
Esempio n. 10
0
//Connects the file session argument.
//Creates application's private datacage on drive C: (if does not exist).
//Copies the private path as string to the aPrivatePath argument (without the drive name).
//aPrivatePath must point to a big enough place (ideally TFileName object).
static void GetFsAndPrivatePathL(RFs& aFs, TDes& aPrivatePath)
	{
	User::LeaveIfError(aFs.Connect());
	TInt err = aFs.CreatePrivatePath(EDriveC);
	if(!(err == KErrNone || err == KErrAlreadyExists))
		{
		User::Leave(err);
		}

	User::LeaveIfError(aFs.PrivatePath(aPrivatePath));
	}
Esempio n. 11
0
//sqlite3SymbianLibInit() - 'File I/O error simulation' test
void sqlite3SymbianLibInitFsErrTest()
	{
	sqlite3SymbianLibFinalize();
	
	TInt sysDrive = static_cast<TInt>(RFs::GetSystemDrive());
	TDriveUnit drvUnit(sysDrive);
	TDriveName drvName = drvUnit.Name();
	
	TFileName path;
	TInt err = TheFs.PrivatePath(path);
	TEST2(err, KErrNone);
	
	TParse privDataCage;
	err = privDataCage.Set(drvName, &path, 0);
	TEST2(err, KErrNone);
	
	err = KErrNotFound;
	TInt cnt = 1;
	for(;err<KErrNone;++cnt)
		{
		for (TInt fsError=KErrNotFound;fsError>=KErrDied;--fsError)
			{
			(void)TheFs.RmDir(privDataCage.FullName());
	
			TInt processHandleCnt = 0;
			TInt threadHandleCnt = 0;
			RThread().HandleCount(processHandleCnt, threadHandleCnt);
			TInt allocCellsCnt = User::CountAllocCells();
			
			(void)TheFs.SetErrorCondition(fsError, cnt);
			err = sqlite3SymbianLibInit();
			(void)TheFs.SetErrorCondition(KErrNone);
			
			if(err != KErrNone)
				{
				TInt processHandleCnt2 = 0;
				TInt threadHandleCnt2 = 0;
				RThread().HandleCount(processHandleCnt2, threadHandleCnt2);
				TEST2(processHandleCnt2, processHandleCnt);
				TEST2(threadHandleCnt2, threadHandleCnt);
				TInt allocCellsCnt2 = User::CountAllocCells();
				TEST2(allocCellsCnt2, allocCellsCnt);
				}
			else
				{
				sqlite3SymbianLibFinalize();
				}
			}
		}
	sqlite3SymbianLibFinalize();
	TheTest.Printf(_L("=== sqlite3SymbianLibInit() 'File I/O error simulation' test succeeded at iteration %d\r\n"), cnt);
	}
Esempio n. 12
0
void TlsCacheUtil::BuildCacheFileNameL(TDes& aFileName, TUid aSid, RFs& aFs)
	{
	TDriveUnit drive(SystemDrive());
	TDriveName driveName(drive.Name());
	aFileName.Append(driveName);
	
	TPath path;
	User::LeaveIfError(aFs.PrivatePath(path));
	aFileName.Append(path);
	
	_LIT(KCacheExtension, ".cce");
	aFileName.AppendNum(aSid.iUid, EHex);
	aFileName.Append(KCacheExtension);
	}
void CCellTowerDataSimulation::InternalizeL() {
	RFs aSession;
	RFile aFile;
	TFileName aFileName;
	TInt aFileSize;

	if(aSession.Connect() == KErrNone) {
		CleanupClosePushL(aSession);

#ifndef __SERIES60_3X__
		aFileName = TFileName(_L("CellTowerSimData.txt"));
		CompleteWithAppPath(aFileName);
#else
		if(aSession.PrivatePath(aFileName) == KErrNone) {
#ifndef __WINSCW__
			aFileName.Insert(0, _L(":"));
			CCommandLineArguments* pArguments;
			TFileName drive;
			pArguments = CCommandLineArguments::NewL();
			if (pArguments->Count() > 0) {
				drive.Append(pArguments->Arg(0)[0]);
				aFileName.Insert(0, drive);
				delete pArguments;
			}
#endif

			aFileName.Append(_L("CellTowerSimData.txt"));

#ifdef __WINSCW__
			aFileName.Insert(0, _L("z:"));
#endif
		}
#endif

		if(aFile.Open(aSession, aFileName, EFileStreamText|EFileRead) == KErrNone) {
			CleanupClosePushL(aFile);
			aFile.Size(aFileSize);

			// Creat buffer & read file
			iCellBuffer = HBufC8::NewL(aFileSize);
			TPtr8 pCellBuffer(iCellBuffer->Des());
			aFile.Read(pCellBuffer);
			aFile.Close();
			
			CleanupStack::PopAndDestroy(&aFile);
		}
		
		CleanupStack::PopAndDestroy(&aSession);
	}
}
// ==========================================================================
// FUNCTION: CleanupTemporaryFile
// ==========================================================================
void CContainerStoreContentManager::WipeContentFiles( RFs& aFs )
    {
    TFileName privatePath;
    TFileName directoryNameWithWildcard;
    
    aFs.PrivatePath( privatePath );

    for( TInt i = 0; i < KNumberOfContentSubdirectories; i++ )
        {
        _LIT( KFormatString, "%SC%i\\*" );
        directoryNameWithWildcard.Format( KFormatString, &privatePath, i );    
        BaflUtils::DeleteFile( aFs, directoryNameWithWildcard );
        } // end for        
    }
Esempio n. 15
0
void TAzenqosEngineUtils::CompleteWithPrivatePathL(TDes& des)
{
#ifdef EKA2//3rd edition
	RFs rfs;
	TFileName fn;

	User::LeaveIfError(rfs.Connect());
	CleanupClosePushL(rfs);
	User::LeaveIfError(rfs.PrivatePath(fn));
	CleanupStack::PopAndDestroy();
	fn += des;
	des = fn;
#else
	CompleteWithAppPath(des);
#endif
}
void PosLmUnzipUtil::ExtractFileL(RFs& aFs, CZipFileMember* aMember, CZipFile* aZipFile, TFileName* aFileName) 
{
	TInt loop=0;
	HBufC* name = aMember->Name()->AllocLC();
	// Change any instances of '/' to '\' in zipped file paths
	while (loop < name->Length()) 
	{
		if ((*name)[loop] == '/') 
		{
			name->Des()[loop] = '\\';
		}
		loop++;
	}
	//set target path
	TBuf<KMaxDirName> privatePath;
	aFs.PrivatePath(privatePath);
	TFileName fn;
	fn.Append(privatePath);
	fn.Append(KExtractZipPath);
	fn.Append(*name);
	
	//create target path if not exist.
	TInt err = aFs.MkDirAll(fn);
	if (err != KErrNone && err != KErrAlreadyExists) 
	{
		User::Leave(err);
	}
	RFile expandedMember;
	User::LeaveIfError(expandedMember.Replace(aFs, fn, EFileShareAny|EFileWrite));
	CleanupClosePushL(expandedMember);
	RZipFileMemberReaderStream* fileStream; 
	
	// KCompressionMethodNotSupported is possible in decompressing file here
	User::LeaveIfError(aZipFile->GetInputStreamL(aMember, fileStream));
	CleanupStack::PushL(fileStream); 
	
	// Assume file contents are 8-bit data
	TUint32 size = aMember->UncompressedSize();
	HBufC8* bytes = HBufC8::NewLC(size);
	TPtr8 ptr = bytes->Des(); //Obtain a modifiable descriptor
	fileStream->Read(ptr, size); 
	// save the unzipped contents to file
	User::LeaveIfError(expandedMember.Write(ptr));
	expandedMember.Close();
	CleanupStack::PopAndDestroy(4); //bytes, fileStream, expandedMember, name
}
void CSenBaseIdentityManager::LoadFromL(TDesC& aFile,
                                                 CSenXmlReader& aReader)
    {
    RFs fss;
    User::LeaveIfError(fss.Connect());
    CleanupClosePushL(fss);
    
    aReader.SetContentHandler(*this);
    SetReader(aReader);

    TInt leaveCode(KErrNone);

#if defined( EKA2 ) || defined( RD_SECURE_PRIV_DATA )
    TBuf<KMaxPath> file;
    fss.CreatePrivatePath(EDriveC);
    fss.PrivatePath(file);
    file.Append(aFile);
    TRAP(leaveCode, aReader.ParseL(fss, file));
#else
    TRAP(leaveCode, aReader.ParseL(fss, aFile));
#endif

#ifdef _SENDEBUG
    if(leaveCode == KErrNotFound)
        {
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"- The senidentities.xml does not exist!");
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"- New file will be generated.");
        }
    else if(leaveCode != KErrNone)
        {
        TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("- Parsing of senidentities.xml leaved: %d"), leaveCode));
        }   
    else
        {
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"- Identity database (senidentities.xml) successfully read.");
        }
#else
    leaveCode=0; // this is a decision: we are not interested 
                 // of invalid input in read/parse phase
#endif

    WriteDatabase(); // Always validate by saving

    CleanupStack::PopAndDestroy(); // fss
    }
Esempio n. 18
0
void CCommandParser::DefaultConfigName(TFileName& aFilename)
	{
    TBuf<KMaxFileName> fname;
    TInt err(KErrNone);
    RFs fs;
    fs.Connect();
    fs.PrivatePath(fname);
    TFindFile ff(fs);
    err = ff.FindByDir(fname,KNullDesC);
    if(err == KErrNone)
        {
        fname.Zero();
        fname = ff.File();
        }
    fname.Append(KDefaultConfig);    
    fs.Close();

    aFilename = fname;
	}
void CEmTubePlaylistManager::ExportPlaylistsL()
	{
	TFileName fileName;
	RFile file;

	RFs session;
	session.Connect();
	CleanupClosePushL( session );

#ifndef __WINS__
	TParsePtrC parse( CEikonEnv::Static()->EikAppUi()->Application()->AppFullName() );
	fileName.Copy( parse.Drive() );
	TPath privateDir;
	User::LeaveIfError( session.PrivatePath( privateDir ) );
	fileName.Append( privateDir );
#else
	fileName.Copy( _L("C:\\Data\\") );
#endif

	fileName.Append( KPlaylistsFilename );

	TInt err = file.Replace( session, fileName, EFileStream | EFileWrite );
	CleanupClosePushL( file );

	if( err == KErrNone )
		{
		RFileWriteStream stream( file );
		CleanupClosePushL( stream );

		stream.WriteInt32L( iPlaylists.Count() );

		for(TInt i=0;i<iPlaylists.Count();i++)
			{
			CEmTubePlaylist* pl = iPlaylists[i];
			pl->ExportL( stream );
			}
		stream.CommitL();
		CleanupStack::PopAndDestroy( &stream );
		}
	CleanupStack::PopAndDestroy( &file );
	CleanupStack::PopAndDestroy( &session );
	}
void getcontentstatus ( TPtrC aContent , TInt& aBLstatus ,TInt& aINstatus)
    {
    RSqlDatabase sqlDB;
    RFs fssession;    
    User::LeaveIfError( fssession.Connect() );
    TFileName privatePath;
    TFileName datafile;    
    fssession.CreatePrivatePath(EDriveC);
    fssession.PrivatePath(privatePath);//data caged path of loading process 
    fssession.Close();
    datafile.Copy(KDriveC);
    datafile.Append(privatePath);    
    datafile.Append( KContentInfoFileName );
    TInt err = sqlDB.Open( datafile );
    
    if ( err  ==KErrNone )
        {
        TSqlScalarFullSelectQuery fullSelectQuery(sqlDB);

        TBuf<100> sql;        
        // Query with INS column 
        _LIT(KgetINstatusSqlFormat, "SELECT INS FROM table1 WHERE NAME = '");
        _LIT(Kendtag, "'");
        sql.Copy( KgetINstatusSqlFormat);
        sql.Append( aContent);
        sql.Append( Kendtag );
        //sql.Format( KgetINstatusSqlFormat , aContent );
        // Read INS as integer.
        aINstatus = fullSelectQuery.SelectIntL(sql);
        
        _LIT(KgetBLstatusSqlFormat, "SELECT BLS FROM table1 WHERE NAME = '");
        sql.FillZ();
        sql.Copy( KgetBLstatusSqlFormat);
        sql.Append( aContent);
        sql.Append( Kendtag );
        //sql.Format( KgetBLstatusSqlFormat , aContent );
        // Read BLS as integer.
        aBLstatus = fullSelectQuery.SelectIntL(sql);
        }
    sqlDB.Close();
    }
Esempio n. 21
0
/*Way to Find AppPrivatePath (A Path where an application can store its private data) */
static TInt GetPrivatePath(TFileName& privatePath)
{
    TFileName KPath;
    RFs fsSession;
    TInt result;

    result = fsSession.Connect();
    if (result != KErrNone)
    {
        return result;
    }
    fsSession.PrivatePath(KPath);
    TFindFile findFile(fsSession);

    privatePath = KPath;
    result = findFile.FindByDir(KPath, KNullDesC);
    if (result == KErrNone)
    {
        privatePath = findFile.File();
    }

    fsSession.Close();
    return result;
}
void CCentRepToolSession::PerformRFSL()
{
	RDEBUG("CentRepToolSession: Restore factory setting operation started");
	//RFS tasks in centrep tool
	// 1. restory setting enforcements
	// 2. remove backup and temp files from private directory
	
	
	//clean private directory
	RFs rfs;
	TInt err = rfs.Connect();
	if( err != KErrNone )
		{
		RDEBUG_2("**** CCentRepToolSession::PerformRFSL() - failed to connect to RFs: %d", err );
		return;
		}
		
	CleanupClosePushL( rfs);
	
	TBuf<100> privatePath;
	err = rfs.PrivatePath( privatePath);
	
	if ( err == KErrNone)
	{
		//remove files from private directory, also backups
		CFileMan* file = CFileMan::NewL( rfs);
		
		privatePath.Append(_L("*.*"));
		err = file->Delete( privatePath, CFileMan::ERecurse);
		delete file;
	}
	
	CleanupStack::PopAndDestroy( &rfs);	
	
	RDEBUG("CentRepToolSession: Restore factory setting operation finished");
}
TUid CDeploymentComponentData::ResolveUidL(RFs& aFs)
    {
    RDEBUG("CDeploymentComponentData::ResolveUidL()");

    TUid ret(TUid::Null() );
    HBufC* buf = HBufC::NewLC(KMaxFileName);
    TPtr16 ptr = buf->Des();
    ptr.Copy(iDataFileName);

    // if PIP/DRM package, we need to use license manager to extract the sis file
    if (iMimeType == KPipMimeType || iMimeType == KDrmMessageMimeType
            || iMimeType == KDrmContentMimeType)
        {
        RDEBUG8_2("	-> mime: %S", &iMimeType );

        RFile originalFile;
        RFile decryptedFile;
        TFileName decryptedTempFileName;

        RDEBUG_2("	-> opening original file: %S", &ptr );
        // leave if can not open the original file
        User::LeaveIfError(originalFile.Open(aFs, ptr, EFileWrite) );
        RDEBUG("	-> done");

        // First construct the temp path
        User::LeaveIfError(aFs.PrivatePath(decryptedTempFileName) );
        // set drive letter into the path
        decryptedTempFileName.Insert( 0, TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
        // append "piptemp\\"	
        decryptedTempFileName.Append(KTempDir);
        // create the folder
        aFs.MkDir(decryptedTempFileName);

        // Use license manager to extract files from the pip package
        CDRMLicenseManager* licenseMgr = CDRMLicenseManager::NewL();
        CleanupStack::PushL(licenseMgr);
        // decryp from the original file into the temp file   
        RDEBUG_2("	-> extracting SIS file into: %S", &decryptedTempFileName);
        User::LeaveIfError(licenseMgr->ExtractSISFileL(originalFile,
                decryptedTempFileName) );
        RDEBUG("	-> done");

        // Get the sis file name 
        decryptedTempFileName.Append( *(licenseMgr->GetSISMemberL()->Name() ));
        // open temporary handle to it.
        RDEBUG_2("	-> opening decrypted file: %S", &decryptedTempFileName );
        User::LeaveIfError(decryptedFile.Open(aFs, decryptedTempFileName,
                EFileShareAny) );
        RDEBUG("	-> done");
        // parse the uid from the file
        ret = ParseUidFromSisFileL(decryptedFile);

        // no use anymore for the decrypted file
        decryptedFile.Close();
        // delete the temp file
        TInt err = aFs.Delete(decryptedTempFileName);
        if (err != KErrNone)
            {
            RDEBUG_2("**** ERROR, unable to delete temporary file: %S", &decryptedTempFileName );
            }

        CleanupStack::PopAndDestroy(licenseMgr);
        decryptedFile.Close();
        originalFile.Close();
        }
    else
        if (iMimeType == KSisxMimeType || iMimeType == KSisMimeType )
            {
            RDEBUG("	-> mime: x-epoc/x-sisx-app");
            RFile originalFile;
            RDEBUG_2("	-> opening file: %S", &ptr );
            User::LeaveIfError(originalFile.Open(aFs, ptr, EFileRead) );
            RDEBUG("	-> opened ok");
            ret = ParseUidFromSisFileL(originalFile);
            originalFile.Close();
            }

        else
            {
            RDEBUG8_2( "**** ERROR - CDeploymentComponentData::ResolveUidL( ) - cannot get uid from mime type: %S", &iMimeType );
            }

    CleanupStack::PopAndDestroy(buf);
    return ret;
    }