1

I'm developing a BlackBerry 10 mobile application using the Momentics IDE 2.1.2 (native SDK).

I created a folder that I named "server" under "assets/images/" folder where I will save the downladed images from server.

For a reason I don't know, when I run my app. using the IDE it works perfectly but when I use the release app (.bar) and install it manually, it doesn't work because the assets forlder is in read-only mode according to this link.

I don't get it !! normally the forlder "server" should be in read/write mode and I need it to be under assets folder because I will use these images and set them in ImageViews using the relative path ("assets:///").

Can any one help me ?

Mohamed Jihed Jaouadi
  • 1,427
  • 4
  • 25
  • 44
  • Don’t know about BB10’s conventions, but reading the page you linked it seems pretty clear that assets is read-only and that you should write to data/ instead. – Frank Osterfeld Nov 10 '15 at 20:21

1 Answers1

0

Like Frank said, assests are read only. Use data folder.

For some reason assets may be read-write in a debug mode, but never as a release.

Edit: access data from c++:

QString path = QString(QDir::homePath() + "/images");

which will go to /data/images

Bojan Kogoj
  • 5,321
  • 3
  • 35
  • 57
  • Actually that's what I did : I saved the images under data and it works. But the problem is that when I try to set one of these images in an imageview normally I should use an absolute path like "assets:///" which in this case should be "data:///" but it is not working (I need to set the image using c++ not qml). – Mohamed Jihed Jaouadi Nov 11 '15 at 10:02
  • I added path to data folder – Bojan Kogoj Nov 11 '15 at 10:15
  • sorry to be late. but it is not working ; I tried to set like : Image img = Image(QUrl("data/image.png")). Also for a reason I don't know "QDir::homePath()" and "QDir::currentPath()" are not working in release mode. – Mohamed Jihed Jaouadi Nov 12 '15 at 09:44
  • Maybe you're missing /(slash)? Try printing path out and paste it here – Bojan Kogoj Nov 12 '15 at 09:46
  • ok ! Actually I created a folder under "data" that I named "images". so When I try to set an Imageview with an image like I said before I use : Image img = Image(QUrl("./data/images/imageName.png")); imgView.setImage(img); – Mohamed Jihed Jaouadi Nov 12 '15 at 09:56
  • It is working !! sorry my bad, I was putting "QDir::homePath()+/data/" it was really stupid I didn't know "homePath" returns the app's directory work path (../data/). Thx a lot !! – Mohamed Jihed Jaouadi Nov 12 '15 at 11:15