coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp
branchRCL_3
changeset 17 d440d4c7e9b4
parent 13 096dad6e50a9
child 24 a72ff4214918
equal deleted inserted replaced
13:096dad6e50a9 17:d440d4c7e9b4
    46     {
    46     {
    47     RFs fileSession;
    47     RFs fileSession;
    48     RFile file;
    48     RFile file;
    49     User::LeaveIfError(fileSession.Connect());
    49     User::LeaveIfError(fileSession.Connect());
    50     TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    50     TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    51 
    51         
    52     if ( err != KErrNone )
    52     if ( err != KErrNone )
    53         {
    53         {
    54         RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
    54         RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
    55         return;
    55         return;
    56         }
    56         }
       
    57 
    57     TInt pos = 0;
    58     TInt pos = 0;
    58     file.Seek(ESeekEnd,pos);
    59     file.Seek(ESeekEnd,pos);
    59     TInt size = files.Count();
    60     TInt size = files.Count();
    60     RBuf filenameBuf;
    61     RBuf filenameBuf;
    61 
    62 
    72         fileText.Seek(ESeekStart);
    73         fileText.Seek(ESeekStart);
    73         fileText.Write(filenameBuf);
    74         fileText.Write(filenameBuf);
    74         CleanupStack::PopAndDestroy();//Filename
    75         CleanupStack::PopAndDestroy();//Filename
    75         file.Flush();
    76         file.Flush();
    76         }
    77         }
       
    78 
    77     file.Close();
    79     file.Close();
    78     fileSession.Close();    
    80     fileSession.Close();    
    79     }
    81     }
    80 
    82 
    81 static void MergeFilesL()
    83 static void MergeFilesL()
    91     TInt number_of_chars;
    93     TInt number_of_chars;
    92     
    94     
    93     User::LeaveIfError(fileSession.Connect());
    95     User::LeaveIfError(fileSession.Connect());
    94     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    96     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    95 
    97 
    96     TInt err1 = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    98 		if(ret != KErrNone)
    97     
    99 			{
    98     fileName.Seek(ESeekEnd,pos);
   100 			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
    99     if ( ret != KErrNone || err1 != KErrNone)
   101 			return;
   100             {
   102 			}
       
   103     ret = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
       
   104     if ( ret != KErrNone)
       
   105             {
       
   106             excludeFileName.Close();
   101             RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
   107             RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
   102             return;
   108             return;
   103             }
   109             }
       
   110     fileName.Seek(ESeekEnd,pos);
       
   111     
   104     HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
   112     HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
   105     TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
   113     TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
   106     
   114     
   107     TInt err(0);
   115     TInt err(0);
   108     err = excludeFileName.Size( size_of_script );
   116     err = excludeFileName.Size( size_of_script );
   152     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
   160     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
   153     
   161     
   154     file.Flush();
   162     file.Flush();
   155     file.Close();
   163     file.Close();
   156     fileSession.Close();
   164     fileSession.Close();
   157     
   165     dir.Close();
   158     Swi::RSisRegistrySession session;
   166     Swi::RSisRegistrySession session;
   159     CleanupClosePushL(session);
   167     CleanupClosePushL(session);
   160     User::LeaveIfError(session.Connect());
   168     User::LeaveIfError(session.Connect());
   161     
   169     
   162     // Get the installed application UIDs
   170     // Get the installed application UIDs