basiclocationinfodisplay/blid/ui/src/FileSystemInfo.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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: Implementation of CFileSystemInfo class which provides application's private path information
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "FileSystemInfo.h"
       
    22 #include <coemain.h>
       
    23 #include <apgcli.h>
       
    24 
       
    25 // ========================= MEMBER FUNCTIONS ================================
       
    26 
       
    27 // ----------------------------------------------------------
       
    28 // CFileSystemInfo::NewL()
       
    29 // ----------------------------------------------------------
       
    30 //
       
    31 CFileSystemInfo* CFileSystemInfo::NewL(const TUid & aApplicationUid)
       
    32     {
       
    33     CFileSystemInfo* self = CFileSystemInfo::NewLC(aApplicationUid);
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ----------------------------------------------------------
       
    39 // CFileSystemInfo::NewLC()
       
    40 // ----------------------------------------------------------
       
    41 //
       
    42 CFileSystemInfo* CFileSystemInfo::NewLC(const TUid & aApplicationUid)
       
    43     {
       
    44     CFileSystemInfo* self = new (ELeave) CFileSystemInfo();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL(aApplicationUid);
       
    47     return self;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CFileSystemInfo::CFileSystemInfo()
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 CFileSystemInfo::CFileSystemInfo()
       
    55     {
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CFileSystemInfo::~CFileSystemInfo()
       
    60 // ---------------------------------------------------------
       
    61 //
       
    62 CFileSystemInfo::~CFileSystemInfo()
       
    63     {
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // CFileSystemInfo::PrivatePath()
       
    68 // ---------------------------------------------------------
       
    69 //
       
    70 TFileName CFileSystemInfo::PrivatePath() const
       
    71 	{
       
    72 	return iPrivatePath;
       
    73 	}
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CFileSystemInfo::ConstructL()
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 void CFileSystemInfo::ConstructL(const TUid & aApplicationUid)
       
    80     {
       
    81     RApaLsSession apaSession;
       
    82     
       
    83     // Connect to application architecture service.
       
    84     User::LeaveIfError( apaSession.Connect() );
       
    85         
       
    86     // Retrieve the application info
       
    87     TApaAppInfo appInfo;
       
    88     User::LeaveIfError( apaSession.GetAppInfo( appInfo, aApplicationUid ) );
       
    89     
       
    90     // Close connection to application architecture service.
       
    91     apaSession.Close();
       
    92             
       
    93     RFs fs;
       
    94     User::LeaveIfError(fs.Connect());
       
    95     
       
    96     // Parse the installation drive from the application path.
       
    97     TParse driveParse;
       
    98     driveParse.Set( appInfo.iFullName, NULL, NULL );
       
    99     iPrivatePath.Append( driveParse.Drive() );
       
   100     
       
   101     // Append the private path to installation drive.
       
   102     TFileName privatePath;
       
   103     fs.PrivatePath( privatePath ); 
       
   104     iPrivatePath.Append( privatePath );    
       
   105     fs.Close();
       
   106     
       
   107     }
       
   108 	
       
   109 // End of file
       
   110