Setting and accessing custom files in android (C++/Qt)
I've been having a problem adding custom files to my android project. It is in full C++ and I am using Qt Creator 3.1.2 to deploy it to my android phone, I am able to have Qt copy over my custom assets over to the assets folder in the android build, however my C++ code uses a macro I make in Qmake called PACKAGE_DIRECTORY and the problem is I do not know what to set that path to when it gets deployed onto the app. Is there any C++ code to access files like this? or Qt to find a directory?
Here is my code to copy over the files:
addon.files = $$PWD/../../../packages/Numbers.pkgdef packages
addon.path = $$[PWD]/assets/packages
INSTALLS += addon
and my variable currently:
PACKAGE_DIRECTORY = /assets/packages/
Thanks in advance for the help!
Hi and welcome to devnet,
AFAIK, the assets are support in Qt through a virtual filesystem. You should be able to access your files using the assets:/ prefix.
Hope it helps
hmm it seems to not work when I try to use that prefix to set my environment variable
DEFINES += PACKAGE_DIRECTORY=assets:/
am I doing something wrong with it?
Not for your environment variable. Create the assets normally and then you can access them in Qt using this prefix.
More about it "here":http://qt-project.org/doc/qt-5/platform-notes-android.html#assets-file-system