Hi all,
I want to ask how to create a folder in N9 device (hidden if possible) and add some files related to my application to it when installing.
also i need that file to be removed when uninstalling the application.
any help??
Thank you
Rondo
Hi all,
I want to ask how to create a folder in N9 device (hidden if possible) and add some files related to my application to it when installing.
also i need that file to be removed when uninstalling the application.
any help??
Thank you
Rondo
Don't know about the hidden property can be there for a folder or not but for deploying folder while the application is installing , keyword DEPLOYMENTFOLDERS can be used in.pro file which contains the folder to be deployed.And though its not hidden but its for sure that it cannot be deleted manually. Also you can add files in that folder only & that whole folder will be deployed while installing For e.g in .pro file:
folder_01.source = source path for folder(from your project directory)
folder_01.target = target path for folder
DEPLOYMENTFOLDERS = folder_01
Hi thank you for your reply
i have added the following into my project file
folder_01.source = qml/qml
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
suppose that i have an image in the folder qml(test.jpg)..if i call this image directly from qml it works well(for ex: iconSource: "test.jpg")
but i want to use that test.jpg from my C++ , i cant find a way to do it!! what should be the path for it?
what i did now is to add the file in the home path as the following
QString path(QDir::home().path());
path.append(QDir::separator()).append("test.jpg");
path = QDir::toNativeSeparators(path);
and use the path of the image..but this file isnt removed when i uninstall the application and it can be deleted from the user even if still use application
so how to solve that?
where should be the path of my folder and how to use that data? also this folder is deleted when uninstalling the app?
Thank you
Rondo
Well you can specify the absolute path of the file for use in c++ code. Let say you keep the file in a folder created inside the qml folder only(say images) then to access the same in your c++ code, the path would be:
/opt/appname/qml/appname/ImageFolder/Image123.jpg
keeping the files in this path , though the files cannot be deleted & they would by default be uninstalled as well, but it is not advisable to read files from here.
The path you used is correct way of keeping files(the home path) & i am sure there is a way exists to remove the files at the time of uninstall(just that i am unable to search it right now)
For deleting files on installation you can write a postrm or prerm script and put in dir qtc_packaging/debian_harmattan
http://www.debian.org/doc/debian-pol...erscripts.html
If the directory is installed by the debian package you don't need to specify any postrm/prerm script.
@vineet.jain: Thank you for ur reply, i used the absolute path and it worked successfully without any error, but can u please guide me more why reading files from that path is not advisable?
@kusumk:i read that link , but didnt get it how to use it..what should be the file name? what is his extension? how to call it? where do i add functions to call it? sorry for my ignorance about it
@gnuton: i have already added the option "Install Debian package to sysroot" and "Deploy Debian package via SFTP upload using device" from Qt Creator , the files found in the absolute path /opt/appname/qml/appname are deleted when uninstalling the application, but my problem is that i am adding some files to the devices from my application( as logs for example) these files are not deleted when uninstalling my application..what i want is to remove all related data of the application while uninstalling
Thank you
Hi,
>>@kusumk:i read that link , but didnt get it how to use it..what should be the file name? what is his extension? how to call it? where do i add functions to call it? sorry for my ignorance about it
Ok. They are called debian maintainer scripts. These scripts are like normal shell scripts. The script has to start with #!/bin/bash
names are postinst, preinst, prerm, postrm. All of them are optional. You would use each of them only when needed. These are placed in the debian_harmattan folder as mentioned earlier.
preinst - this script is executed prior to the installation of the package.
postinst - this script is executed after the installation of the package.
prerm - this script is executed prior to the un-installation of the package.
postrm - this script is executed after the un-installation of the package.
In your case you would place something like this in prerm or postrm script, depending on when you want it to be executed -
#! /bin/sh
rm -rf /home/user/demo.txt
So from your queries, now you know how to name the files. they do not have extensions, they need not be explicitly called.
They are taken care of by the dpkg tool when you uninstall your package. You need not do anything.
Hope this helps!
Well my purpose was saying this was that you won't be able to modify anything at this path(/opt/appname/..) as adding/deleting files to this path are not allowed on runtime.Though i have to admit, you can read the files from here.
Any file/folder which is deployed at installation time though debian package is deleted at uninstall time but at the same time you cannot modify those files/folder.
And yes for log files which you would be making at runtime , you have to create a separate folder which of course is not deleted on uninstalling the application.
Sorry for beeing late,
thank you all for your help
problem solved with using prerm to remove my files..thank you kusumk
and thank you vineet.jain too, i will use the home path to add my files
Regards,
Rondo