04-23-2012 09:16 AM
I am working on a game using ndk, I have given path to assets folder(which contains two subfolders dirXmls and dirTextures) in bardescripter.xml, dirXmls contains configuration files and dirTextures contains images.
Now I am trying to open an xml file named config.xml that exists in dirXmls using following code
FILE *fp=fopen("dirxmls/config.xml","rb");
but fopen returns NULL also I have tried following line
FILE *fp=fopen("assets/dirXmls/config.xml","rb");
but still it return NULL;
can anyone guide me where possibly I am doing wrong.
Regards
Ahsan
04-23-2012 09:28 AM - edited 04-23-2012 09:29 AM
You should read this page, in particular the "Folders accessible to an application" part at the bottom: https://bdsc.webapps.blackberry.com/native/documen
In short, you like need to put "app/" and probably something else in front of those paths, e.g. "app/native/dirxmls/config.xml", but you may need something else. The "app/" part is to get from the current directory of your app at run time, down to where the .bar contents are unpacked.
What path you use following that depends on the structure of the data in your .bar file. If you have never looked, examine it with an "unzip" utility (it's just a .zip file with a different file extension) and figure it out. Most native apps will have everything under a folder "native/", and maybe your files are a level or two below that.
04-24-2012 02:29 AM
Hi
Thanx for your valued response, Now I can read file by appeneding "app/native/assets" at the start of my path, but here I have one more question that can I specify in some configuration that this path should be appended at the start of all paths, so that i dont have to change a lot of code.
Regards
Ahsan