Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook
Accepted Solution

App can't see *.jpg files on SD card

I'm trying to read the list of jpg files on in the sdcard's camera directory. It seems to see some of the images, but not all of them. Currently I've deleted all photos and copied a JPG file into that directory from my computer, and it's not seeing it, My code, roughly, is as follows:

 

QStringList nameFilters;

nameFilters.append("*.jpg");
nameFilters.append("*.jpeg");

QDir sdDir("/accounts/1000/removable/sdcard/camera/");

QFileInfoList sdPhotos = sdDir.entryInfoList(nameFilters, QDir::Files, QDir::Time);

qDebug() << "Number of SD photos: " << sdPhotos.size();

 

There is definitely a jpg file in that directory. I have also used the "Target File System Navigator" in the IDE to browse to:

 

System/accounts/1000/removable/sdcard/camera/

 

... and I can see the file.


And yes, my app has permission to used shared files.

 

I don't have any brilliant ideas for why the app can't see the file. (and even stranger that my recollection was that, before I cleared the directory, it saw a small subset of the files in the directory)

Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook

Re: App can't see *.jpg files on SD card

Yeah... as I thought: If I take a photo with the camera and try again, it now sees that 1 file, but doesn't see the other test.jpg file there. What gives?

Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook

Re: App can't see *.jpg files on SD card

If I connect to the device via telnet and go to that directory, I see this:

 

$ cd camera
$ ls -ltr
total 3265
-rw-rw---- 1 root 1000_shared 894237 Mar 10 21:27 test.jpg
-rw-rw---- 1 root 1000_shared 777109 Mar 10 23:07 IMG_20140310_230720.jpg

 

So the two files are plainly there, and they both have the same permissions, but:

 

Number of SD photos:  1 

 

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: App can't see *.jpg files on SD card

Hi,

Looks like this problem hasn't been fixed yet:
http://supportforums.blackberry.com/t5/Testing-and-Deployment/Shared-subdirectories-inaccessible-to-...
QDirIterator isn't compiled for 64-bit file node support.
Try using the C code from the thread above as a workaround.

Andrey Fidrya, @zmeyc on twitter
Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook

Re: App can't see *.jpg files on SD card

Wow.... *rolls eyes*

 

This is when I say "REALLY?!?!?".

 

If this was reported early last year and was never fixed in the API, I am scarce to come up with a good excuse for team BlackBerry... oh yoy yoy.

 

I'll give this theory a try tonight to see if resolve the issue. Thanks very much for pointing me to that forum post.

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: App can't see *.jpg files on SD card

You might like to check if a report has been submitted on this in DIT and if not submit one.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook

Re: App can't see *.jpg files on SD card

The related forum post does refer to two tickets, but when I click them, I get:

 

Permission Violation

You cannot view this issue because you are not the issue reporter or assignee, a member of the project group, or a member of the issue group and this issue is closed or in triage.

If you think this message is wrong, please consult your administrators about getting the necessary permissions.

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: App can't see *.jpg files on SD card

[ Edited ]

Okay, that's fine then. I get the same warning, hopefully that means it's been moved to the roadmap, perhaps it's tied in to the QT 5.0 release?!?

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
dbigham
Posts: 552
Registered: ‎04-01-2009
My Device: Z10, PlayBook

Re: App can't see *.jpg files on SD card

I gave it a try, and sure enough, adding:

 

DEFINES += _FILE_OFFSET_BITS=64
DEFINES += _LARGEFILE64_SOURCE=1

 

... to the .pro file solves the issue.