Namespaces
Variants
Actions
Revision as of 10:42, 23 July 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Export files to private directory in a Qt for Symbian project

Jump to: navigation, search
Article Metadata

Article
Created: ltomuta (31 Oct 2010)
Last edited: hamishwillee (23 Jul 2012)

In a Symbian project, data files can be exported at the correct location under SDK emulator's file system using the prj_exports section of the bld.inf file.

...
PRJ_EXPORTS
// source destination
.\data\image1.png \epoc32\winscw\c\private\E1234567\image1.png

The example above shows how an image is exported from project's data directory to application's private directory on the emulated C drive. Each time you build this project with a new SDK the data files are exported based on the rules above and will be available to the emulated application. The only thing to consider is that if application's UID3/SID changes then these PRJ_EXPORTS rules must be updated as well, to reflect the new home directory.

In a Qt project, the Symbian specific UID3/SID is defined in the *.pro file and these allows us to write PRJ_EXPORTS rules which are automatically updated, by using the UID3/SID value in defining the path:

symbian:{
 
TARGET.UID3 = 0xE1234567
...
PRIVATEDIR=$$replace(TARGET.UID3, "^0x", "")
...
export_files = "./data/image1.png /epoc32/winscw/c/private/"$${PRIVATEDIR}"/image1.png"
BLD_INF_RULES.prj_exports += export_files
...
}

The solution is based on the qmake function $$replace which is used to extract the value of the UID3, without the 0x prefix, into a new variable, PRIVATEDIR, which is then used to build the path for export's destination.

81 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved