brandingserver/bsserver/cbsstoragemanager.cpp
branchRCL_3
changeset 21 cfd5c2994f10
parent 2 89455bbf90d8
child 22 113b91e0a2ad
equal deleted inserted replaced
20:eedf17a17c27 21:cfd5c2994f10
     1 /*
     1 /*
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8 *
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Stores element data and writes it to stream
    14 * Description:   Stores element data and writes it to stream
    15 *
    15 *
    16 */
    16 */
       
    17 
    17 
    18 
    18 
    19 
    19 #include <s32strm.h>
    20 #include <s32strm.h>
    20 #include <s32file.h>
    21 #include <s32file.h>
    21 #include <f32file.h>
    22 #include <f32file.h>
    32 #endif
    33 #endif
    33 #include "cbsserver.h"
    34 #include "cbsserver.h"
    34 #include "cbssession.h"
    35 #include "cbssession.h"
    35 #include "mbsupdater.h"
    36 #include "mbsupdater.h"
    36 //#include "importlogwriter.h"
    37 //#include "importlogwriter.h"
    37 #include "debugtrace.h"
    38 #include "DebugTrace.h"
    38 
    39 
    39 
    40 
    40 // ======== MEMBER FUNCTIONS ========
    41 // ======== MEMBER FUNCTIONS ========
    41 
    42 
    42 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
   264     TInt length = aAppId.Length() + aBrandId.Length() +
   265     TInt length = aAppId.Length() + aBrandId.Length() +
   265                   KDefFileName().Length() + KDirSeparator().Length() * 2 +
   266                   KDefFileName().Length() + KDirSeparator().Length() * 2 +
   266                   langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght;
   267                   langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght;
   267 	fileName = HBufC::NewLC( length );
   268 	fileName = HBufC::NewLC( length );
   268     
   269     
       
   270     if(fileName){
   269     TPtr file( fileName->Des() );
   271     TPtr file( fileName->Des() );
   270 
   272 
   271     // [application_id]\[brand_id]\[def_filename][language_id]
   273     // [application_id]\[brand_id]\[def_filename][language_id]
   272     //
   274     //
   273     
   275     
   283 	    TBuf<KMaxVersionLenght> versionBuffer;
   285 	    TBuf<KMaxVersionLenght> versionBuffer;
   284 	    versionBuffer.AppendNum( aReserved );
   286 	    versionBuffer.AppendNum( aReserved );
   285 	    file.Append( KDot() );
   287 	    file.Append( KDot() );
   286     	file.Append( versionBuffer );
   288     	file.Append( versionBuffer );
   287     	}
   289     	}
   288 
   290     	
   289     if( fileName )
   291     	CleanupStack::Pop( fileName );      
   290     	{
   292     }
   291     	CleanupStack::Pop( fileName );
       
   292     	}
       
   293     return fileName;
   293     return fileName;
   294     }
   294     }
   295 
   295 
   296 // ---------------------------------------------------------------------------
   296 // ---------------------------------------------------------------------------
   297 // CBSStorageManager::CreateStorageL
   297 // CBSStorageManager::CreateStorageL
   898 		
   898 		
   899 		CDir* files = NULL;
   899 		CDir* files = NULL;
   900 		CDir* directories = NULL;
   900 		CDir* directories = NULL;
   901 		
   901 		
   902 		User::LeaveIfError( iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ) );
   902 		User::LeaveIfError( iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ) );
   903 
       
   904 		CleanupStack :: PushL (files);
       
   905 		CleanupStack :: PushL (directories);
       
   906 		
   903 		
   907 		TInt count = files->Count();
   904 		TInt count = files->Count();
   908 		for( TInt i = 0; i < count; i++ )
   905 		for( TInt i = 0; i < count; i++ )
   909 			{
   906 			{
   910 			const TEntry file = (*files)[ i ];
   907 			const TEntry file = (*files)[ i ];
   938 						}
   935 						}
   939 					}
   936 					}
   940 				}
   937 				}
   941 			CleanupStack::PopAndDestroy( fullName );
   938 			CleanupStack::PopAndDestroy( fullName );
   942 			}
   939 			}
   943 		
   940 		CleanupStack::PopAndDestroy( nameWithDrive );
   944 		CleanupStack :: PopAndDestroy (directories);
       
   945 		CleanupStack :: PopAndDestroy (files);
       
   946 		CleanupStack :: PopAndDestroy (nameWithDrive);
       
   947 		}
   941 		}
   948 	TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") );
   942 	TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") );
   949 	}
   943 	}
   950 
   944 
   951 // ---------------------------------------------------------------------------
   945 // ---------------------------------------------------------------------------