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..
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)
Re: Path to featch a file from any location in memory card
[QUOTE=vineet.jain;904212]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)[/QUOTE]
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
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?
Re: Path to featch a file from any location in memory card
[QUOTE=vineet.jain;904217]Ok, is the case only with media files? what happen if you try to access, let say a .txt file?[/QUOTE]
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.
Re: Path to featch a file from any location in memory card
Please help me in this issue......
Re: Path to featch a file from any location in memory card
[QUOTE=akki123;904247]Please help me in this issue......[/QUOTE]
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..
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 ..
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.
Re: Path to featch a file from any location in memory card
[QUOTE=symbianyucca;904258]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.[/QUOTE]
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.
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.