harvesterplugins/file/fastfindfileserverplugin/inc/fsutil.inl
changeset 0 ccd0fd43f247
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Some generic utilities.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 inline TUint32 FSUtil::MediaID( const RFs& aFs, TInt aDrive )
       
    20     {
       
    21     TVolumeInfo vi;
       
    22     
       
    23     TInt err = aFs.Volume(vi, aDrive);
       
    24     if(err == KErrNone)
       
    25         {
       
    26         return vi.iUniqueID;
       
    27         }
       
    28         
       
    29     return 0;
       
    30     }
       
    31 
       
    32 inline TUint32 FSUtil::MediaID( const RFs& aFs, const TDesC& aUri )
       
    33     {
       
    34     TInt drive = DriveNumber(aUri);
       
    35     if(drive == -1)
       
    36         {
       
    37         return 0;
       
    38         }
       
    39         
       
    40     return MediaID(aFs, drive);
       
    41     }
       
    42 
       
    43 inline TInt FSUtil::DriveNumber( const TDesC& aUri )
       
    44     {
       
    45     TChar ch = aUri[0];
       
    46     TInt drive = 0;
       
    47     TInt err = RFs::CharToDrive(ch, drive);
       
    48     if(err == KErrNone)
       
    49         {
       
    50         return drive;
       
    51         }
       
    52         
       
    53     return -1;
       
    54     }
       
    55