Export to GitHub

android-lighthouse - issue #52

qSettings write error


Posted on Nov 26, 2010 by Happy Elephant

Using qSettings to save settings results in an error. Presumably because it tries to save them to ~/.config, which is probably not the right location.

What steps will reproduce the problem?

==

include <QSettings>

qSettings s; s.setValue("test", "test"); s.sync(); if ( s->status() == s->AccessError)

qDebug() << "Something went wrong";

I tried modifying the default location where settings are kept in src/core/io/qsettings.cpp : initDefaultPaths() to the folder the application is stored in, like this:

==

ifdef Q_OS_WIN

....

elif defined(Q_OS_ANDROID)

    /* Use application path for all settings */
    QString appPath = QCoreApplication::applicationDirPath()+QLatin1Char('/');
    pathHash-&gt;insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), appPath);

pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), appPath);

However that does not work either. It seems applicationDirPath() returns empty instead of the right path.

Comment #1

Posted on Dec 11, 2010 by Swift Horse

(No comment was entered for this change.)

Comment #2

Posted on Jan 17, 2011 by Swift Horse

(No comment was entered for this change.)

Comment #3

Posted on Feb 21, 2011 by Swift Horse

Is should be fixed in the latest SDK (http://sourceforge.net/projects/necessitas/files/).

Thank you.

Status: Fixed

Labels:
Type-Defect Priority-Critical