Problem with QSettings - failure to store ini in custom directory
I am upgrading my old application to store app settings in user-specified directory.
Previously I stored it in "default" location, whatever this location is and I did not care.
Now I do care and quickly changed the code to store settings in user-specified directly. Did not work.
I could not figure out what is wrong with the code. I wrote a test to illustrate the problem I am having.
Please see the debug output - it appends organization name and domain to the specified path. WTF?
It is so counter-intuitive.
I can't change organization name etc, the app should support "old" and "new" ways. So, my questions are:
1. Perhaps I am doing something wrong. What it might be?
2. Is there a way to store ini file in specific directly in the case shown in the test below?
Thanks in advance!
Code:
#include <QCoreApplication>
#include <QSettings>
#include <QDebug>
int main(int argc, char *argv[])
{
//from the documentation: This function doesn't affect existing QSettings objects.
//Returns the path where settings written using this QSettings object are stored.
qDebug() << settings.fileName();
// debug output: "C:/test/testApp.ini/testOrganization/testAppName.ini"
return a.exec();
}
Re: Problem with QSettings - failure to store ini in custom directory
QSettings::setPath sets directory not file. Maybe you should use the right version of the constructor :
Re: Problem with QSettings - failure to store ini in custom directory