harvesterplugins/media/mediautils/src/cpixindexerutils.cpp
changeset 20 68cdadcf169e
parent 17 7d8c8d8f5eab
child 26 367228f82b66
equal deleted inserted replaced
17:7d8c8d8f5eab 20:68cdadcf169e
    26 const TInt KMsgPluginBaseAppClassMaxLen = 64;
    26 const TInt KMsgPluginBaseAppClassMaxLen = 64;
    27 
    27 
    28 // local declarations and functions
    28 // local declarations and functions
    29 namespace {
    29 namespace {
    30 _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\");
    30 _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\");
    31 _LIT(KIndexingDBPath,"indexing\\indexdb");
       
    32 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB);
    31 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB);
    33 
    32 
    34 _LIT(KAtSign, "@");
    33 _LIT(KAtSign, "@");
    35 _LIT(KColon, ":");
    34 _LIT(KColon, ":");
    36 };
    35 };
   275         CPIXLOGSTRING2("CCPixIndexerUtils::MountL Drive %d already Mounted",aMedia);
   274         CPIXLOGSTRING2("CCPixIndexerUtils::MountL Drive %d already Mounted",aMedia);
   276         return;
   275         return;
   277         }
   276         }
   278     if(IsDriveCanbeMountedL(aMedia))
   277     if(IsDriveCanbeMountedL(aMedia))
   279         {
   278         {
   280         //clean the existing database if any
       
   281         RemoveUnmountedDatabaseL(aMedia,aPath);
       
   282         // Form the baseappclass for this media
   279         // Form the baseappclass for this media
   283         TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
   280         TBuf<KMsgPluginBaseAppClassMaxLen> baseAppClass;
   284         FormBaseAppClass(TDriveNumber(aMedia), aBaseAppClassGeneric,baseAppClass);
   281         FormBaseAppClass(TDriveNumber(aMedia), aBaseAppClassGeneric,baseAppClass);
   285     
   282     
   286         // Define this volume
   283         // Define this volume
   468 RArray<TDriveNumber>& CCPixIndexerUtils::CCPixIndexerUtils::GetMountedDriveList()
   465 RArray<TDriveNumber>& CCPixIndexerUtils::CCPixIndexerUtils::GetMountedDriveList()
   469     {
   466     {
   470     return iMountedDrives;
   467     return iMountedDrives;
   471     }
   468     }
   472 
   469 
   473 // -----------------------------------------------------------------------------
       
   474 // CCPixIndexerUtils::RemoveUnmountedDatabase()
       
   475 // -----------------------------------------------------------------------------
       
   476 //
       
   477 void CCPixIndexerUtils::RemoveUnmountedDatabaseL(TDriveNumber aMedia, const TDesC& aPath)
       
   478     {
       
   479     RFs aFs;
       
   480     User::LeaveIfError( aFs.Connect() );
       
   481     TChar drive;
       
   482     TInt err = aFs.DriveToChar((TDriveNumber)aMedia,drive);
       
   483     if ( err == KErrNone )
       
   484         {
       
   485         TBuf<KMaxFileName> folderpath;
       
   486         folderpath.Append(drive);
       
   487         folderpath.Append(KColon);
       
   488         folderpath.Append(KCPixSearchServerPrivateDirectory);
       
   489         folderpath.Append(KIndexingDBPath);
       
   490         folderpath.Append(aPath);
       
   491         CFileMan* FileMan = CFileMan::NewL(aFs);
       
   492         if ( FileMan )
       
   493             FileMan->Delete( folderpath );
       
   494         delete FileMan;
       
   495         }
       
   496     aFs.Close();
       
   497     }
       
   498 
       
   499 //End of file
   470 //End of file