brandingserver/bsserver/cbsinstallhandler.cpp
changeset 46 860cd8a5168c
parent 35 085f765766a0
equal deleted inserted replaced
35:085f765766a0 46:860cd8a5168c
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: CBSInstallhandler.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include <apgcli.h>
       
    21 #include <apacmdln.h>
       
    22 #include <eikenv.h>
       
    23 #include <bautils.h>
       
    24 #include <utf.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 #include "cbsinstallhandler.h"
       
    28 #include "debugtrace.h"
       
    29 #include "bsimportconstants.h"
       
    30 #include "cbsstoragemanager.h"
       
    31 
       
    32 
       
    33 // CONSTANTS
       
    34 // branding installer application
       
    35 _LIT( KInstallerApp,            "bsinstall.exe" );
       
    36 
       
    37 
       
    38 // wildcard for finding installed brand files
       
    39 _LIT( KBrandWild,               "*" );
       
    40 
       
    41 // Line feed separates uninstalled brands from each other
       
    42 _LIT( KLineFeed,                "\n" );
       
    43 
       
    44 
       
    45 // Pub&Sub Key for uninstalled brands
       
    46 const TUint KUninstallKey       = 0x01;
       
    47 
       
    48 
       
    49 // METHODS
       
    50 
       
    51 // Two-phased constructor.
       
    52 CBSInstallHandler* CBSInstallHandler::NewL( )
       
    53     {
       
    54     TRACE( T_LIT( "CBSInstallHandler::NewL begin") );
       
    55     CBSInstallHandler* self = new ( ELeave ) CBSInstallHandler() ;
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop( self );
       
    59     TRACE( T_LIT( "CBSInstallHandler::NewL end") );
       
    60     return self;
       
    61     }
       
    62 
       
    63 // Symbian OS default constructor can leave.
       
    64 void CBSInstallHandler::ConstructL()
       
    65     {
       
    66     User::LeaveIfError( iFs.Connect() );
       
    67     CActiveScheduler::Add( this );
       
    68     }
       
    69 
       
    70 // Destructor
       
    71 CBSInstallHandler::~CBSInstallHandler()
       
    72     {
       
    73     Cancel();
       
    74     iFs.Close();
       
    75     }
       
    76 
       
    77 // C++ default constructor can NOT contain any code, that
       
    78 // might leave.
       
    79 //
       
    80 CBSInstallHandler::CBSInstallHandler() :
       
    81     CActive( EPriorityIdle )
       
    82 	{
       
    83 	}
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CBSInstallHandler::InstallNewFilesL()
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CBSInstallHandler::InstallNewFilesL()
       
    90     {
       
    91 	TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL begin") );
       
    92     TInt needInstaller = 0;
       
    93     
       
    94         
       
    95     TRAP_IGNORE( needInstaller += CheckForDiscardedBrandsL( KBSDataStore ) );
       
    96 
       
    97     // uninstall removed brands
       
    98     needInstaller += 
       
    99         SyncFilesL( KInstallPath, KInstallObservePath, EInstallDeleteFromSrc );
       
   100     
       
   101     // install new brands
       
   102     needInstaller += 
       
   103         SyncFilesL( KInstallObservePath, KInstallPath, EInstallCopyNewToDest );
       
   104     
       
   105     if( needInstaller )
       
   106         {
       
   107         // something new was installed
       
   108         LaunchInstallerAppL();
       
   109         }
       
   110 	TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL end") );
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CBSInstallHandler::StartObservingL()
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CBSInstallHandler::StartObservingL()
       
   118 	{
       
   119 	TRACE( T_LIT( "CBSInstallHandler::StartObservingL begin") );
       
   120 	if( IsActive() )
       
   121 	    {
       
   122 	    __ASSERT_DEBUG( EFalse, User::Leave( KErrAlreadyExists ) );
       
   123 	    return;
       
   124 	    }
       
   125 	
       
   126 	// observe path: (drive:)[private](/import/install)
       
   127 	TPath path( KNullDesC );
       
   128 	GetPrivateFolder( path, KInstallObservePath );
       
   129     
       
   130     iFs.NotifyChange( ENotifyEntry, iStatus, path );
       
   131     SetActive();
       
   132 	TRACE( T_LIT( "CBSInstallHandler::StartObservingL end") );
       
   133 	}
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CBSInstallHandler::StopObserving()
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 void CBSInstallHandler::StopObserving()
       
   140 	{
       
   141 	TRACE( T_LIT( "CBSInstallHandler::StopObserving begin") );
       
   142     Cancel();
       
   143 	TRACE( T_LIT( "CBSInstallHandler::StopObserving end") );
       
   144 	}
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CBSInstallHandler::DoCancel()
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 void CBSInstallHandler::DoCancel()
       
   151     {
       
   152     iFs.NotifyChangeCancel();
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // CBSInstallHandler::RunL()
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 void CBSInstallHandler::RunL()
       
   160     {
       
   161 	TRACE( T_LIT( "CBSInstallHandler::RunL start") );
       
   162     if( iStatus == KErrNone )
       
   163         {
       
   164         TRACE( T_LIT( "CBSInstallHandler::RunL installing...") );
       
   165         TRAP_IGNORE( InstallNewFilesL() );
       
   166         StartObservingL();
       
   167         }
       
   168     else
       
   169         {
       
   170         TRACE( T_LIT( "CBSInstallHandler::RunL observing stopped") );
       
   171         }
       
   172 	TRACE( T_LIT( "CBSInstallHandler::RunL end") );
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CBSInstallHandler::LaunchInstallerAppL()
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void CBSInstallHandler::LaunchInstallerAppL()
       
   180     {
       
   181 	TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL start") );
       
   182     // initialize RApaLsSession
       
   183     RApaLsSession apas;
       
   184     User::LeaveIfError( apas.Connect() );
       
   185     CleanupClosePushL( apas );
       
   186     apas.GetAllApps();
       
   187     
       
   188     // start installer
       
   189     CApaCommandLine* command = CApaCommandLine::NewLC();
       
   190     command->SetExecutableNameL( KInstallerApp );
       
   191     User::LeaveIfError( apas.StartApp( *command ) );
       
   192     TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL bsinstall.exe launched OK") );
       
   193 
       
   194     CleanupStack::PopAndDestroy( 2 ); // apas, command
       
   195 	TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL end") );
       
   196     }
       
   197     
       
   198 // -----------------------------------------------------------------------------
       
   199 // CBSInstallHandler::SyncFilesL()
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 TBool CBSInstallHandler::SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, 
       
   203                                      TInstallOperation aOperation )
       
   204     {
       
   205 	TRACE( T_LIT( "CBSInstallHandler::SyncFilesL start") );
       
   206 
       
   207     // Check new install folder
       
   208     HBufC* fileBuf = HBufC::NewLC( KMaxFileName );
       
   209     TPtr file( fileBuf->Des() );
       
   210     GetPrivateFolder( file, aSrcDir );
       
   211     
       
   212     TBool ret = BaflUtils::PathExists( iFs, file );
       
   213     if( !ret )
       
   214         {
       
   215         // install folder doesn't exist.
       
   216     	TRACE( T_LIT( 
       
   217             "CBSInstallHandler::SyncFilesL no src folder!") );
       
   218         CleanupStack::PopAndDestroy( fileBuf );
       
   219         return EFalse;
       
   220         }
       
   221 
       
   222     // Apply extension filter
       
   223     file.Append( KBrandWild );       //
       
   224     file.Append( KBrandInstallExt ); // *.install
       
   225 
       
   226     // Get list of src dir files
       
   227     CDir* dir = NULL;
       
   228     User::LeaveIfError( iFs.GetDir( file, 
       
   229         KEntryAttNormal, ESortNone, dir ) );
       
   230     CleanupStack::PushL( dir );
       
   231     
       
   232     // Create destination directory
       
   233     GetPrivateFolder( file, aDestDir );
       
   234     BaflUtils::EnsurePathExistsL( iFs, file );
       
   235     
       
   236     // Compare source dir to destination
       
   237     TBool OperationExecuted = EFalse;
       
   238     TInt count = dir->Count();
       
   239 
       
   240     for( TInt i = 0; i < count; i++ )
       
   241         {
       
   242         GetPrivateFolder( file, aDestDir );
       
   243         file.Append( (*dir)[i].iName );
       
   244         if( !BaflUtils::FileExists( iFs, file ) )
       
   245             {
       
   246             // file does not exist in destionation dir
       
   247             // => react according to operation
       
   248             HBufC* fileSrcBuf = HBufC::NewLC( KMaxFileName );
       
   249             TPtr fileSrc( fileSrcBuf->Des() );
       
   250             GetPrivateFolder( fileSrc, aSrcDir );
       
   251             fileSrc.Append( (*dir)[i].iName );
       
   252             
       
   253             switch( aOperation )
       
   254                 {
       
   255                 case EInstallCopyNewToDest:
       
   256                     {
       
   257                     // copy new files from src to destination
       
   258                     TRACE( T_LIT( "CBSInstallHandler::SyncFilesL copy") );
       
   259                     OperationNotifyL( aOperation, file );
       
   260                     User::LeaveIfError( BaflUtils::CopyFile( 
       
   261                         iFs, fileSrc, file ) );
       
   262                     break;
       
   263                     }
       
   264                 case EInstallDeleteFromSrc:
       
   265                     {
       
   266                     // delete files from src if they are not found from dest
       
   267                     TRACE( T_LIT( "CBSInstallHandler::SyncFilesL del") );
       
   268                     OperationNotifyL( aOperation, fileSrc );
       
   269                     User::LeaveIfError( BaflUtils::DeleteFile( iFs, fileSrc ) );
       
   270                     break;
       
   271                     }
       
   272                 default:
       
   273                     {
       
   274                     // Every operation should have a case!
       
   275                     __ASSERT_DEBUG( EFalse, 
       
   276                         User::LeaveIfError( KErrArgument ) );
       
   277                     }
       
   278                 }
       
   279             
       
   280             OperationExecuted = ETrue;
       
   281             CleanupStack::PopAndDestroy( fileSrcBuf );
       
   282             }
       
   283         }
       
   284     CleanupStack::PopAndDestroy( 2 ); // fileBuf, dir
       
   285     TRACE( T_LIT( "CBSInstallHandler::SyncFilesL end") );
       
   286     return OperationExecuted;
       
   287     }
       
   288 
       
   289 // -----------------------------------------------------------------------------
       
   290 // CBSInstallHandler::OperationNotifyL()
       
   291 // -----------------------------------------------------------------------------
       
   292 //
       
   293 void CBSInstallHandler::OperationNotifyL( TInstallOperation aOperation, 
       
   294                                           const TDesC& aSrcFile )
       
   295     {
       
   296 	TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL start") );
       
   297     if( aOperation == EInstallDeleteFromSrc )
       
   298         {
       
   299         // parse brand id and application id from filename
       
   300         TParse parse;
       
   301         parse.Set( aSrcFile, NULL, NULL );
       
   302         
       
   303         // find ids from filename
       
   304         TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator );
       
   305         TInt secondSepar = parse.Name().
       
   306             Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator );
       
   307         TInt cutlen = 0;
       
   308         secondSepar == KErrNotFound ? cutlen = parse.Name().Length() :
       
   309                                       cutlen = firstSepar + secondSepar + 1;
       
   310         
       
   311         // brandString: [brandId]$[appId]
       
   312         TPtrC brandString ( parse.Name().Left( cutlen ) );
       
   313         if( IsBrandInstalled( brandString ) )
       
   314             {
       
   315             TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL %S exists in import\\install =>RProperty NOT UPDATED!"),&aSrcFile );
       
   316             // brand still exists, so no need to uninstall.
       
   317             return;
       
   318             }
       
   319 
       
   320         // Create discardedbrand.txt file in the /appid/brandid path
       
   321         CreateFlagFile( aSrcFile );
       
   322                 
       
   323         UpdateRPropertyL( brandString );
       
   324         
       
   325         TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL uninstall string to pub&sub updated OK") );
       
   326         }
       
   327 	TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL end") );
       
   328     }
       
   329     
       
   330 // -----------------------------------------------------------------------------
       
   331 // CBSInstallHandler::IsBrandInstalled()
       
   332 // -----------------------------------------------------------------------------
       
   333 //
       
   334 TBool CBSInstallHandler::IsBrandInstalled( const TDesC& aBrand )
       
   335     {
       
   336 	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled start") );
       
   337     TFileName file;
       
   338     GetPrivateFolder( file, KInstallObservePath );
       
   339     file.Append( aBrand );
       
   340     file.Append( KBrandInstallExt );
       
   341     
       
   342     // check file directly: 
       
   343     // aaa$bbb -> aaa$bbb.install
       
   344     CDir* dir = NULL;
       
   345     iFs.GetDir( file, KEntryAttNormal, ESortNone, dir );
       
   346     if( dir->Count() > 0 )
       
   347         {
       
   348         // brand is installed
       
   349         delete dir;
       
   350     	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") );
       
   351         return ETrue;
       
   352         }
       
   353     delete dir;
       
   354     dir = NULL;
       
   355 
       
   356     GetPrivateFolder( file, KInstallObservePath );
       
   357     file.Append( aBrand );
       
   358     file.Append( KInstallFileDataSeparator );
       
   359     file.Append( KBrandWild );
       
   360     file.Append( KBrandInstallExt );
       
   361     
       
   362     // check file with different versions:
       
   363     // aaa$bbb -> aaa$bbb$*.install
       
   364     iFs.GetDir( file, KEntryAttNormal, ESortNone, dir );
       
   365     if( dir->Count() > 0 )
       
   366         {
       
   367         // brand is installed
       
   368         delete dir;
       
   369     	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") );
       
   370         return ETrue;
       
   371         }
       
   372     delete dir;
       
   373     
       
   374     // brand is not installed
       
   375 	TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled false") );
       
   376     return EFalse;
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CBSInstallHandler::GetPrivateFolder()
       
   381 // -----------------------------------------------------------------------------
       
   382 //
       
   383 void CBSInstallHandler::GetPrivateFolder( TDes& aPath, const TDesC& aAppend )
       
   384     {
       
   385     iFs.PrivatePath( aPath );
       
   386     aPath.Insert( 0, KInstallDrive );
       
   387     aPath.Append( aAppend );
       
   388     }
       
   389 
       
   390 void CBSInstallHandler::CreateFlagFile(const TDesC& aSrcFile)
       
   391 	{
       
   392 	TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile begin") );
       
   393 	// parse brand id and application id from aSrcFile
       
   394 	TParse parse;
       
   395 	parse.Set( aSrcFile, NULL, NULL );
       
   396 
       
   397 	// find ids from filename
       
   398 	TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator );
       
   399 
       
   400 	// Get the brand Id
       
   401 	HBufC* brandId = (parse.Name().Left(firstSepar)).AllocL();
       
   402 
       
   403 	// to get application id
       
   404 	TInt secondSepar = parse.Name().
       
   405 	    Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator );
       
   406 	
       
   407 	TInt cutlen = 0;
       
   408 	secondSepar == KErrNotFound ? cutlen = parse.Name().Length() :
       
   409 	                              cutlen = firstSepar + secondSepar + 1;
       
   410 
       
   411 
       
   412 	TParse parseAgain;
       
   413 	parseAgain.Set(parse.Name().Left( cutlen ), NULL, NULL );
       
   414 	HBufC* applicationId = (parseAgain.Name().Right( cutlen - firstSepar - 1)).AllocL(); 
       
   415 	
       
   416 
       
   417 	HBufC *fileName = CBSStorageManager::ConstructDiscardBrandFileNameL(*applicationId, *brandId) ;
       
   418 	CleanupStack::PushL(fileName);
       
   419 	HBufC *fullPath = CBSStorageManager::FullDiscardBrandFileNameLC( *fileName ) ;
       
   420 	
       
   421 	// crate a flag file
       
   422 	RFile file;
       
   423 	file.Create(iFs, *fullPath, EFileWrite);
       
   424 	file.Close() ;
       
   425 	
       
   426 	delete brandId ;
       
   427 	delete applicationId ;
       
   428 	
       
   429 	CleanupStack::PopAndDestroy(fullPath) ;
       
   430 	CleanupStack::PopAndDestroy(fileName) ;
       
   431 	TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile end") );
       
   432 	}
       
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 // CBSInstallHandler::CheckForDiscardedBrandsL()
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 TBool CBSInstallHandler::CheckForDiscardedBrandsL( const TDesC& aDir )
       
   439     {
       
   440     TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL begin") );
       
   441     TBool discardedBrandExists( EFalse );
       
   442        
       
   443     CDir* appDir = NULL; // will contain all application folders     
       
   444     
       
   445     TPath path;
       
   446     iFs.PrivatePath( path );
       
   447     path.Insert( 0, KInstallDrive );
       
   448     path.Append( aDir ); 
       
   449     path.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\"    
       
   450 
       
   451     User::LeaveIfError( 
       
   452         iFs.GetDir( path, KEntryAttDir, ESortNone, appDir ) );
       
   453     CleanupStack::PushL( appDir );
       
   454 
       
   455     /*TFileName find( path );
       
   456     find.Append( KInstallFiles );*/
       
   457     
       
   458     // create array of files (as text)
       
   459     TInt count = appDir->Count();
       
   460     //for each application do...
       
   461     for( TInt i = 0; i < count; i++ )
       
   462         { 
       
   463         TFileName file( path );
       
   464         file.Append( (*appDir)[i].iName );
       
   465         file.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\xsp\\"    
       
   466         
       
   467         TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL AppDir='%S'"),&file );
       
   468         CDir* brandDir = NULL; // will contain all brand folder for each application 
       
   469         User::LeaveIfError( 
       
   470             iFs.GetDir( file, KEntryAttDir, ESortNone, brandDir ) );
       
   471         CleanupStack::PushL( brandDir );
       
   472         
       
   473         TInt countBrands = brandDir->Count();
       
   474         //for each brand of a certain application do...
       
   475         for( TInt j(0) ; j < countBrands ; j++ )
       
   476             {            
       
   477             TFileName discardedFile( file );
       
   478             discardedFile.Append( (*brandDir)[j].iName );
       
   479             discardedFile.Append( KDirSeparator );
       
   480             discardedFile.Append( KDiscardBrandFileName );   // "C:\\private\\102828dd\\data\\xsp\\branda\\discarded.txt"    
       
   481             
       
   482             TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL BrandDir='%S'"),&file );
       
   483             
       
   484             // check for the existance of the 'discarded.txt' file  
       
   485             if ( BaflUtils::FileExists( iFs, discardedFile ) )
       
   486                 {
       
   487                 TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL '%S' found!=>brand is discarded."),&discardedFile );
       
   488                 discardedBrandExists = ETrue;
       
   489                 
       
   490                 //set RProperty for this brand                
       
   491                 
       
   492                 //the string written to RProperty: 
       
   493                 //"[brandId]$[applicationId]"(e.g."branda$xsp")
       
   494                 HBufC* writeBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
       
   495                 TPtr writeData( writeBuf->Des() );                
       
   496                 writeData.Append( (*brandDir)[j].iName );
       
   497                 writeData.Append( KInstallFileDataSeparator );
       
   498                 writeData.Append( (*appDir)[i].iName );
       
   499                 TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL uninstallstring='%S'"),writeBuf );
       
   500                 
       
   501                 //UpdateProperty here!!!
       
   502                 UpdateRPropertyL( writeData );
       
   503                 
       
   504                 CleanupStack::PopAndDestroy( writeBuf );
       
   505                 }
       
   506             }        
       
   507         CleanupStack::PopAndDestroy( brandDir );
       
   508         }
       
   509 
       
   510     CleanupStack::PopAndDestroy( appDir );    
       
   511     TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL end") );
       
   512     return discardedBrandExists;
       
   513     }
       
   514 
       
   515 
       
   516 // -----------------------------------------------------------------------------
       
   517 // CBSInstallHandler::UpdateRPropertyL 
       
   518 // -----------------------------------------------------------------------------
       
   519 //
       
   520 void CBSInstallHandler::UpdateRPropertyL( const TDesC& aUninstallationString )
       
   521     {
       
   522     HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
       
   523     TPtr data( dataBuf->Des() );                
       
   524     
       
   525     // Update uninstall string to pub&sub (only if the RProperty does not 
       
   526     // contain the unistallation string yet)
       
   527     RProcess me;
       
   528     TUid uid = me.Identity();
       
   529     TInt ret = RProperty::Define( uid, KUninstallKey, RProperty::EText);
       
   530     if( ret != KErrAlreadyExists )
       
   531         {
       
   532         TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty does not exist") );
       
   533         User::LeaveIfError( ret );
       
   534         }
       
   535     TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty created/exists OK") );    
       
   536     User::LeaveIfError( RProperty::Get( uid, KUninstallKey, data ) );
       
   537     
       
   538     // don't append the uninstall string in case it already exists
       
   539     // in the RProperty
       
   540     if( KErrNotFound == data.Find( aUninstallationString ) )
       
   541         {
       
   542         if( data.Length() > 0 )
       
   543             {
       
   544             data.Append( KLineFeed );
       
   545             TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL lineFeed appended to RProperty uninstallstring") );
       
   546             }
       
   547         data.Append( aUninstallationString );
       
   548         TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' appended to RProperty uninstallstring"), &aUninstallationString );
       
   549         if( data.Length() <= RProperty::KMaxPropertySize )
       
   550             {
       
   551             User::LeaveIfError( RProperty::Set( uid, KUninstallKey, data ) );
       
   552             TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty::Set OK") );
       
   553             }
       
   554         }
       
   555     else
       
   556         {
       
   557         TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' already exists in RProperty"), &aUninstallationString );    
       
   558         }
       
   559         
       
   560     CleanupStack::PopAndDestroy( dataBuf );   
       
   561     
       
   562     }
       
   563 
       
   564 //  END OF FILE