qtqmakesailfish-os

Create other folder with qmake/Qt


Using Qt creator (SailfishOS SDK), I would like that my myapp.pro make a directory in the /home/nemo/.local/share to store user's data on installation with files like /home/nemo/.local/share/myapp/data.extension.

I tried:

newdirectory.extra = mkdir /home/nemo/.local/share/myapp
INSTALLS += newdirectory

but I got this at compile time:

mkdir: cannot create directory '/home/nemo/.local/share/myapp': Permission denied

Does anyone knows the Qt way for that?

Thank you


Solution

  • I think you are confusing INSTALL targets with deployment. INSTALL targets are used when you do make install. Read how app packaging for SailfishOS is done.

    Besides, this is a bad idea to use the installation procedure to create a directory to store the app settings and stuff. Do it from the app itself. Create the directory if it doesn't exist yet, for example if it's the first time your app is started or if the user deleted the directory accidentally.