×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Path to featch a file from any location in memory card

    Suppose if i want to access some files with particular extension from any location in the phone Memory then we will define the path as c:\\data.
    & we will put the condition for the extension check

    Same thing if i want to do from memory card the what should be the path.
    Actually in my application i am accessing the file with the extension .mp3 or .mp4 i am able to access it from any location from phone memory but in the case of memory card if i am putting the path e:\\ then none of the file is accessible.

    In case of phone memory i put the path as c:\\data..

    Please help me out of this..

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: Path to featch a file from any location in memory card

    What is the full file path which you try to access?(try making a debug file & write the same in that & see what path gets written)

  3. #3
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Re: Path to featch a file from any location in memory card

    Quote Originally Posted by vineet.jain View Post
    What is the full file path which you try to access?(try making a debug file & write the same in that & see what path gets written)
    It could be in any folder in side the memory card with a particular extension.
    ex- .mp3, in e:\\games as well as e:\\tones

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: Path to featch a file from any location in memory card

    Ok, is the case only with media files? what happen if you try to access, let say a .txt file?

  5. #5
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Re: Path to featch a file from any location in memory card

    Quote Originally Posted by vineet.jain View Post
    Ok, is the case only with media files? what happen if you try to access, let say a .txt file?
    Actually i want to access media files & well as .jpg & .mp4 files.

    I put the condition to check the extension of the file & it will show the files with that particular extension only .

    In case of phone memory i am putting the path c:\\data & within this it will search the file But in case of memory card when i am putting the path e:\\ it is not showing any file available in the memory card.

  6. #6
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Re: Path to featch a file from any location in memory card

    Please help me in this issue......

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Path to featch a file from any location in memory card

    Quote Originally Posted by akki123 View Post
    Please help me in this issue......
    You should have a bit more patience, and not expect all question to be answered in such a short time. Anyway, I'm not getting on what actual API and how you are suing it to get the list of file, so maybe you would want to clar that out.

    also, please feel free to use any 3rd party file browser to see the actual folder structure, in general things in memory card are not located under data-folder..

  8. #8
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Re: Path to featch a file from any location in memory card

    HBufC* ptr1 = HBufC::NewL(50);
    TPtr pathName = ptr1->Des();
    TInt path1 = aPath;
    TInt count = 0;

    path1 = iPhotosAppUi->ImageFolderPath();

    if( path1 == 0)
    pathName.Copy(KFolderPhoneTones);
    else if( path1 == 1)
    pathName.Copy(KFolderMMCTones);

    where KFolderPhoneTones is defined as _LIT(KFolderPhoneTones,"c:\\Data\\");
    & _LIT(KFolderMMCTones,"e:\\Sounds\\");

    ok..


    after that to put the filter as per the extension i did

    if (BaflUtils::FileExists(aSession, pathName))
    {
    CDir* aDir = NULL;
    CDirScan* dirscan = CDirScan::NewLC(aSession);

    dirscan->SetScanDataL(pathName, KEntryAttDir, ESortByName|EAscending, CDirScan::EScanDownTree);

    dirscan->NextL(aDir);

    while(1)
    {

    filepath.Copy(dirscan->FullPath());

    filepath.Append(_L("*"));
    delete aDir;
    aDir = NULL;
    aSession.GetDir(filepath, KEntryAttNormal, ESortByDate, aDir);
    if(aDir != NULL)
    {
    CleanupStack::PushL(aDir);

    for(TInt i = 0; i < aDir->Count(); i++)
    {

    data.Copy((*aDir)[i].iName);
    HBufC* ptr2 = HBufC::NewL(50);
    TPtr ext = ptr2->Des();
    TInt pos = data.LocateReverse('.');
    if(pos != -1)
    {
    ext.Copy(data.Right(data.Length() - pos));
    data.Delete(pos , data.Length() - pos);
    }

    if( path1 == 0)
    {
    if(ext.Compare(_L(".mp3")) == 0 || ext.Compare(_L(".wav")) == 0 || ext.Compare(_L(".aac")) == 0 || ext.Compare(_L(".wma")) == 0||ext.Compare(_L(".m4a")) == 0)
    {
    count++;
    }
    }
    else if( path1== 1)
    {
    if(ext.Compare(_L(".mp3")) == 0 || ext.Compare(_L(".wav")) == 0 || ext.Compare(_L(".aac")) == 0 || ext.Compare(_L(".wma")) == 0||ext.Compare(_L(".m4a")) == 0)
    {
    count++;
    }
    }


    & to list all the files


    HBufC* ptr1 = HBufC::NewL(50);
    TPtr pathName = ptr1->Des();
    TInt path1;
    TInt count = 0;

    path1 = iPhotosAppUi->ImageFolderPath();

    if( path1 == 0)
    pathName.Copy(KFolderPhoneTones);
    else if( path1 == 1)
    pathName.Copy(KFolderMMCTones);
    else if( path1 == 2)
    pathName.Copy(KFolderPhoneGames);
    else if( path1 == 3)
    pathName.Copy(KFolderMMCGames);

    RFs aSession;
    aSession.Connect();

    if (BaflUtils::FileExists(aSession, pathName))
    {
    CDir* aDir = NULL;
    CDirScan* dirscan = CDirScan::NewLC(aSession);

    dirscan->SetScanDataL(pathName, KEntryAttDir, ESortByName|EAscending, CDirScan::EScanDownTree);

    dirscan->NextL(aDir);

    while(1)
    {

    delete aDir;
    aDir = NULL;

    filepath.Copy(dirscan->FullPath());

    filepath.Append(_L("*"));

    delete aDir;
    aDir = NULL;

    aSession.GetDir(filepath, KEntryAttNormal, ESortByDate, aDir);
    if(aDir != NULL)
    {
    CleanupStack::PushL(aDir);

    for(TInt i = 0; i < aDir->Count(); i++)
    {

    data.Copy((*aDir)[i].iName);

    filepath.Copy(dirscan->FullPath());
    filepath.Append(data);

    HBufC* ptr3 = HBufC::NewL(50);
    TPtr tmptime = ptr3->Des();

    TTime time;
    time = (*aDir)[i].iModified;

    TDateTime aDateTime = time.DateTime();

    //dd/mm/yyyy hh:mm:ss am
    _LIT(KFormatTxt,"%d/%d/%d-%d:%d:%d ");

    TBuf<2> ampm;

    TInt hour = aDateTime.Hour();

    if(hour>12) {
    hour=hour-12;
    ampm.Copy(_L("pm"));
    }
    else{
    ampm.Copy(_L("am"));
    }

    tmptime.Format(KFormatTxt,aDateTime.Day()+1,TInt(aDateTime.Month()+1),
    aDateTime.Year(), hour, aDateTime.Minute(), aDateTime.Second());

    tmptime.Append(ampm);
    HBufC* ptr2 = HBufC::NewL(50);
    TPtr ext = ptr2->Des();
    TInt pos = data.LocateReverse('.');
    if(pos != -1)
    {
    ext.Copy(data.Right(data.Length()-pos));
    data.Delete(pos , data.Length()-pos);
    }

    if( path1 == 0)
    {
    if(ext.Compare(_L(".mp3")) == 0 || ext.Compare(_L(".wav")) == 0 || ext.Compare(_L(".aac")) == 0 || ext.Compare(_L(".wma")) == 0||ext.Compare(_L(".m4a")) == 0)
    {
    ImageDataPhonearray->InsertL(count, data);
    ImageDatePhonearray->InsertL(count, tmptime);
    iPhoneSize->InsertL(count, (*aDir)[i].iSize);
    ImageDataPhoneFilearray->InsertL(count, filepath);

    count++;
    }
    }
    else if( path1 == 1)
    {
    if(ext.Compare(_L(".mp3")) == 0 || ext.Compare(_L(".wav")) == 0 || ext.Compare(_L(".aac")) == 0 || ext.Compare(_L(".wma")) == 0||ext.Compare(_L(".m4a")) == 0)
    {
    ImageDataMmcarray->InsertL(count, data);
    ImageDateMmcarray->InsertL(count, tmptime);
    iMmcSize->InsertL(count, (*aDir)[i].iSize);
    ImageDataMmcFilearray->InsertL(count, filepath);

    count++;
    }
    }
    else if( path1 == 2)
    {
    if(ext.Compare(_L(".jar")) == 0)
    {
    ImageDataPhonearray->InsertL(count, data);
    ImageDatePhonearray->InsertL(count, tmptime);
    iPhoneSize->InsertL(count, (*aDir)[i].iSize);
    ImageDataPhoneFilearray->InsertL(count, filepath);

    count++;
    }
    }

    From here i am able to get the file with these extension from phone memory if they are installed at any location. But when i am trying to access the files with these extension from memory card i am unable to get the same.
    i tried with

    _LIT(KFolderMMCTones,"e:\\"); also. \

    but it is not showing any files.


    In case of phone memory i am able to access the .mp3 file from any location within the phone memory ex- c:\\image or c:\\games or c:\\
    but in case of memory card i am getting these files on when i am putting these files inside e::\\sounds\\.......
    I want to access all the .mp3 file which is saved in memory card not only from a particular location ..
    Last edited by akki123; 2012-10-01 at 12:35.

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Path to featch a file from any location in memory card

    As said, please do check the memory card folders with any 3rd party file manager, one free would be available in my site at drjukka.com. Basically the folder structure is not the same, so you might need to change them in your code.

    Also you could try debugging in the device to see what happens when your code is executed.

  10. #10
    Regular Contributor
    Join Date
    Jul 2012
    Posts
    82

    Re: Path to featch a file from any location in memory card

    Quote Originally Posted by symbianyucca View Post
    As said, please do check the memory card folders with any 3rd party file manager, one free would be available in my site at drjukka.com. Basically the folder structure is not the same, so you might need to change them in your code.

    Also you could try debugging in the device to see what happens when your code is executed.
    I checked the same with active file (3rd party file manager) but as per this we have e:\\ and different user defined folders. like tones,games,video,& all.
    But in c: drive we have c:\\ data & after that we have other folders.... like tones,games,video,& all.

  11. #11
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Path to featch a file from any location in memory card

    Yep, also the folder names might change with different language variants, so you could maybe try PathInfo class for the folder names, and see if that helps.

Similar Threads

  1. How to get the path to photos on memory card?
    By heman in forum Mobile Java General
    Replies: 6
    Last Post: 2012-09-03, 10:15
  2. How to set path to memory card of the mobile?
    By mkhpad in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2012-02-21, 04:56
  3. Replies: 3
    Last Post: 2011-06-20, 14:29
  4. How to get the path to photos on memory card?
    By piyush_kyada in forum [Archived] Qt Mobility Project
    Replies: 3
    Last Post: 2010-12-29, 07:55
  5. N75 video and picture path in memory card
    By vijaypatidar in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-07-28, 13:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •