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