Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.2, 5.9.2
-
None
-
22ec92a201beb9ec4bb6a7e21fcfdc8cd9b884f9 (qtbase/5.10, 2.12.2017, 5.10.1)
Description
Hi, i'm having problems loading settings with QSettings on a windows machine.
I have a symlink file in the Project/debug folder that points to another file in another folder (writable and readable) when I try to read some setting from that file it behave like the file doesn't exists, when I try to write some settings on that link it overwrites the entire file deleting all the settings in it.
The link file is a symlink, not a normal shortcut (that doesn't work either, the same behavior is triggered) is created with the windows tool mklink using the command:
mklink test.ini "D:\usr\test.ini"
main.cpp:
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QSettings> #include <Qdir> #include <QCoreApplication> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; qInfo(QString(QCoreApplication::applicationDirPath()+"/test.ini").toLatin1().data()); QSettings* _persisted_repository = new QSettings(QCoreApplication::applicationDirPath()+"/test.ini", QSettings::IniFormat); _persisted_repository->setValue("aa","false"); //_persisted_repository->setValue("bb","false"); _persisted_repository->setValue("cc","false"); qInfo(_persisted_repository->value("bb").toString().toLatin1().data()); _persisted_repository->sync(); return app.exec(); }
even if the setting "bb=false" is originally in the file it disappear and this line has a null output in the console:
qInfo(_persisted_repository->value("bb").toString().toLatin1().data());
P.S: this behavior is not triggered with a file that is not a link or a simlink, the same code with "test.ini" as a normal file works fine
Attachments
For Gerrit Dashboard: QTBUG-64121 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
209950,6 | QSettings/QConfFile: Fix reading on NTFS symbolic links | 5.10 | qt/qtbase | Status: MERGED | +2 | 0 |