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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
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
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

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
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

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
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

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
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

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
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

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. Smiley Happy

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

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
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

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. Smiley Happy

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

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.