I'm making a (qt) cross platform application that stores both cache and settings files. After a lot of searching, i still haven't found how and where to store them. Please note that i want to use QT's stuff only where i would otherwise reinvent the wheel or save insane amounts of time; i want absolute control over the behavior of the application and qt is rather random or inefficient at times.
For linux, the default would be /etc//, but there's no write access there and my app writes changes to it's config file. for cache, that would be /var//, but by default there is no write access either. the settings and cache should preferably be user independent as it's server software.
I have thought of several solutions, but they don't seem very elegant:
any ideas? what's best practice? where does this stuff go on windows and mac?
Some clarification: It's a server application that is supposed to run independently of a single user, so it's not desired to store anything at all in /home. It's also not using any gui features of QT, the server is going to be managed by either settings files or a separate GUI that communicates with the server over IP.
If you really want to use these folders your application should be executed partially or completely with root privileges.
Another thing you can do is:
myDir
for your application, and everything is stored inside this work directory (the same way qtcreator does if you want an example). /opt
is a good candidate. myDir
the required privilege to access\modify\execute files you want are set up for the users group.myDir
itself requires root to delete, but not the files inside.Without an installer you will be the installer: moving around executing scripts and commands, and eventually writing an installation document (we are doing this in our startup now and it is just painful, we are in the process of changing to full installer mode)
Note : Not an expert, but using two types of machines as servers seems like you guys are really looking for trouble. Or your app is targeting servers of all types maybe?