How to Deploy and Use Files in Application Private Directory for Symbian: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' [[How to Deploy and Use Files in Application Private Directory for Symbian Bulgarian|Български]]
[[Category:HowTo]]<br />[[Category:Snippets]]


=How to Deploy and Use Files in Application Private Directory for Symbian=
[toc align_right=&quot;yes&amp;quot; depth=&quot;2&amp;quot;]


==Private Directory==
'''English''' [[How_to_Deploy_and_Use_Files_in_Application_Private_Directory_for_Symbian_Bulgarian|Български]]


Symbian platform security model defines that each application has a private directory which name depends on the application <span class="caps">UID</span>.<br /> Only the application itself (and backup software) has read and write access to this directory.
= How to Deploy and Use Files in Application Private Directory for Symbian =


==File Deployment==
== Private Directory ==


The <span class="caps">DEPLOYMENT</span> keyword have to used at pro file to deploy file to the private directory of the application.
Symbian platform security model defines that each application has a private directory which name depends on the application UID.<br />Only the application itself (and backup software) has read and write access to this directory.


The example shows how to copy test.txt from the local directory of the project to the private directory of the application on Symbian device. <br />
== File Deployment ==


Please note that path should be change if you want to deploy the file on another location or in a sub folder.
The DEPLOYMENT keyword have to used at pro file to deploy file to the private directory of the application.


==Using Files Located at the Application Private Directory==
The example shows how to copy test.txt from the local directory of the project to the private directory of the application on Symbian device.<br /><code><br />test.sources = &quot;test.txt&amp;quot;<br />test.path = .<br />DEPLOYMENT ''= test<br /></code>
<br />Please note that path should be change if you want to deploy the file on another location or in a sub folder.
<br />h2. Using Files Located at the Application Private Directory
<br />After installation on a Symbian device the file will be located in the application private dir which can be obtained using &quot;QApplication::applicationDirPath()&quot;:http://doc.qt.nokia.com/latest/qcoreapplication.html#applicationDirPath
<br />* Remember to include &quot;QApplication&amp;quot;:http://doc.qt.nokia.com/latest/qcoreapplication.html<br /><code><br />#include &lt;QApplication&amp;gt;<br /></code>
<br />* Open file<br /><code><br />//generate the file path<br />QString sFile = QApplication::applicationDirPath()'' &quot;/test.txt&amp;quot;;<br />QFile file&amp;amp;#40;sFile&amp;amp;#41;;<br />//Open the file<br />if (file.open(QIODevice::ReadOnly | QIODevice::Text))<br />{<br /> //Do something<br />}<br /></code>


After installation on a Symbian device the file will be located in the application private dir which can be obtained using [http://doc.qt.nokia.com/latest/qcoreapplication.html#applicationDirPath QApplication::applicationDirPath()] ''[doc.qt.nokia.com]''
== See Also ==


* Remember to include [http://doc.qt.nokia.com/latest/qcoreapplication.html QApplication] ''[doc.qt.nokia.com]''<br />
&quot;Symbian Platform Security Model&amp;quot;:http://wiki.forum.nokia.com/index.php/Symbian_Platform_Security_Model<br />&quot;Using the DEPLOYMENT keyword in a Qt package file&amp;quot;:http://wiki.forum.nokia.com/index.php/CS001424_-_Using_the_DEPLOYMENT_keyword_in_a_Qt_package_file
 
* Open file<br />
 
==See Also==
 
[http://wiki.forum.nokia.com/index.php/Symbian_Platform_Security_Model Symbian Platform Security Model] ''[wiki.forum.nokia.com]''<br />[http://wiki.forum.nokia.com/index.php/CS001424_-_Using_the_DEPLOYMENT_keyword_in_a_Qt_package_file Using the <span class="caps">DEPLOYMENT</span> keyword in a Qt package file] ''[wiki.forum.nokia.com]''<br />[http://developer.qt.nokia.com/wiki/Symbian_FAQ Symbian <span class="caps">FAQ</span>] ''[developer.qt.nokia.com]''
 
===Categories:===
 
* [[:Category:HowTo|HowTo]]
* [[:Category:snippets|snippets]]

Revision as of 10:12, 24 February 2015


[toc align_right="yes&quot; depth="2&quot;]

English Български

How to Deploy and Use Files in Application Private Directory for Symbian

Private Directory

Symbian platform security model defines that each application has a private directory which name depends on the application UID.
Only the application itself (and backup software) has read and write access to this directory.

File Deployment

The DEPLOYMENT keyword have to used at pro file to deploy file to the private directory of the application.

The example shows how to copy test.txt from the local directory of the project to the private directory of the application on Symbian device.

<br />test.sources = &quot;test.txt&amp;quot;<br />test.path = .<br />DEPLOYMENT ''= test<br />


Please note that path should be change if you want to deploy the file on another location or in a sub folder.
h2. Using Files Located at the Application Private Directory
After installation on a Symbian device the file will be located in the application private dir which can be obtained using "QApplication::applicationDirPath()":http://doc.qt.nokia.com/latest/qcoreapplication.html#applicationDirPath


* Remember to include "QApplication&quot;:http://doc.qt.nokia.com/latest/qcoreapplication.html

<br />#include &lt;QApplication&amp;gt;<br />


* Open file

<br />//generate the file path<br />QString sFile = QApplication::applicationDirPath()'' &quot;/test.txt&amp;quot;;<br />QFile file&amp;amp;#40;sFile&amp;amp;#41;;<br />//Open the file<br />if (file.open(QIODevice::ReadOnly | QIODevice::Text))<br />{<br /> //Do something<br />}<br />

See Also

"Symbian Platform Security Model&quot;:http://wiki.forum.nokia.com/index.php/Symbian_Platform_Security_Model
"Using the DEPLOYMENT keyword in a Qt package file&quot;:http://wiki.forum.nokia.com/index.php/CS001424_-_Using_the_DEPLOYMENT_keyword_in_a_Qt_package_file