PDA

View Full Version : QSetting value() not correct



bpetty
14th August 2006, 20:47
Hey guys. I am having a problem with QSetting. The problem is that I am reading from an ini that looks like this:

[Current Server Directory]
current.dir=c:\indir

I am using the following code:


QSettings INConfig(sPath, QSettings::IniFormat);
std::cout << "ServerDir: " << INConfig.value("Current Server Directory/current.dir").toString().toStdString() << std::endl;


Basically, my problem is that it returns: c:ndir
I call this a bug... troll tech may call this a feature. Is there anyway to turn this "feature" off?

;) Thank,
Brandon P.

jacek
14th August 2006, 20:58
As the docs say:
Although backslash is a special character in INI files, most Windows applications don't escape backslashes (\) in file paths:
windir = C:\Windows
QSettings always treats backslash as a special character and provides no API for reading or writing such entries.
All you can do is to use "\\", "/" (this should work under windows too) or write your own format handler.