How to include files in Symbian Deployment so it will be accessible?

1.9k views Asked by At

I tried to include files in my Qt program (for symbian) and ran it via the emulator. No files were exported. The code I've been using in my QMake file is:

symbian {
    TARGET.UID3 = 0xe22a34fe
    # TARGET.CAPABILITY += 
    TARGET.EPOCSTACKSIZE = 0x14000
    TARGET.EPOCHEAPSIZE = 0x020000 0x800000

    addFiles.sources = 01.jpg 02.jpg 03.jpg
    addFiles.path = .
    DEPLOYMENT += addFiles
}

OTHER_FILES += \
    03.jpg \
    02.jpg \
    01.jpg

As such, a call to QDir::entryInfoList() will reveal no files:

QDir dir = QDir::current();
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();
// list is empty.

Am I missing something in the .pro file?

3

There are 3 answers

5
KevinD On BEST ANSWER

When you deploy these files, where are you expecting them to be placed?

addFiles.path = .

to me is indeterminate - the is no 'current' directory when the files are deployed.

Provide a path you know exists. I've certainly used the app private directory for this purpose:

addFiles.path = \private\e22a34fe

...then you can get the directory of your files with

QApplication::applicationDirPath()

If you are running on the emulator, also check if the files are deployed. If you are using the 'real' Symbian emulator (rather than the rather horrible QT version), you'll find the file system under epoc32\winscw

0
chalup On

On Symbian OS all exe and dll files are kept in /sys/bin directory, and each application keep it's data in /private/APPUID directory (where APPUID is the application UID3). Deploying files to "." will deploy the files to application's private directory (in your case it will be /private/e22a34fe as KevinD mentioned, because you have "TARGET.UID3 = 0xe22a34fe" in your .pro file).

To find out where the files will be deployed on device check the appname_template.pkg generated by qmake. It's syntax is pretty straightforward (and in case of any problems you can read the documentation).

I'm not sure which directory is returned by QDir::current() on Symbian, but the documentation states that QCoreApplication::applicationDirPath() should return path to application's private dir.

1
RajaRaviVarma On

If you are going to use those files only withing your application then you can try using Qt Resource file.

To add a new Resource file File->New File->Files and Classes->Qt->Qt Resource file. Then add the necessary files u need. All the images will be converted into equivalent unicode text or something. Deploying files with Qt application