brandingserver/bsserver/cbsstoragemanager.cpp
branchRCL_3
changeset 22 113b91e0a2ad
parent 21 cfd5c2994f10
equal deleted inserted replaced
21:cfd5c2994f10 22:113b91e0a2ad
     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 the License "Eclipse Public License v1.0"
     5 * under the terms of "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 
       
    18 
    17 
    19 
    18 
    20 #include <s32strm.h>
    19 #include <s32strm.h>
    21 #include <s32file.h>
    20 #include <s32file.h>
    22 #include <f32file.h>
    21 #include <f32file.h>
    33 #endif
    32 #endif
    34 #include "cbsserver.h"
    33 #include "cbsserver.h"
    35 #include "cbssession.h"
    34 #include "cbssession.h"
    36 #include "mbsupdater.h"
    35 #include "mbsupdater.h"
    37 //#include "importlogwriter.h"
    36 //#include "importlogwriter.h"
    38 #include "DebugTrace.h"
    37 #include "debugtrace.h"
    39 
    38 
    40 
    39 
    41 // ======== MEMBER FUNCTIONS ========
    40 // ======== MEMBER FUNCTIONS ========
    42 
    41 
    43 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
   265     TInt length = aAppId.Length() + aBrandId.Length() +
   264     TInt length = aAppId.Length() + aBrandId.Length() +
   266                   KDefFileName().Length() + KDirSeparator().Length() * 2 +
   265                   KDefFileName().Length() + KDirSeparator().Length() * 2 +
   267                   langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght;
   266                   langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght;
   268 	fileName = HBufC::NewLC( length );
   267 	fileName = HBufC::NewLC( length );
   269     
   268     
   270     if(fileName){
       
   271     TPtr file( fileName->Des() );
   269     TPtr file( fileName->Des() );
   272 
   270 
   273     // [application_id]\[brand_id]\[def_filename][language_id]
   271     // [application_id]\[brand_id]\[def_filename][language_id]
   274     //
   272     //
   275     
   273     
   285 	    TBuf<KMaxVersionLenght> versionBuffer;
   283 	    TBuf<KMaxVersionLenght> versionBuffer;
   286 	    versionBuffer.AppendNum( aReserved );
   284 	    versionBuffer.AppendNum( aReserved );
   287 	    file.Append( KDot() );
   285 	    file.Append( KDot() );
   288     	file.Append( versionBuffer );
   286     	file.Append( versionBuffer );
   289     	}
   287     	}
   290     	
   288 
   291     	CleanupStack::Pop( fileName );      
   289     if( fileName )
   292     }
   290     	{
       
   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);
   903 		
   906 		
   904 		TInt count = files->Count();
   907 		TInt count = files->Count();
   905 		for( TInt i = 0; i < count; i++ )
   908 		for( TInt i = 0; i < count; i++ )
   906 			{
   909 			{
   907 			const TEntry file = (*files)[ i ];
   910 			const TEntry file = (*files)[ i ];
   935 						}
   938 						}
   936 					}
   939 					}
   937 				}
   940 				}
   938 			CleanupStack::PopAndDestroy( fullName );
   941 			CleanupStack::PopAndDestroy( fullName );
   939 			}
   942 			}
   940 		CleanupStack::PopAndDestroy( nameWithDrive );
   943 		
       
   944 		CleanupStack :: PopAndDestroy (directories);
       
   945 		CleanupStack :: PopAndDestroy (files);
       
   946 		CleanupStack :: PopAndDestroy (nameWithDrive);
   941 		}
   947 		}
   942 	TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") );
   948 	TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") );
   943 	}
   949 	}
   944 
   950 
   945 // ---------------------------------------------------------------------------
   951 // ---------------------------------------------------------------------------