diff options
author | Bai Jing <jing.t.bai@nokia.com> | 2012-03-05 20:20:30 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-06 15:17:40 +0100 |
commit | d4d0aa90793e235f53a3defffd2b74d5215240a6 (patch) | |
tree | c742647fad167ff746338efe46c2b7c88786f593 /tools | |
parent | 91c768cfa5e921a978c8feae269e1587296846f0 (diff) |
jsondb-client: fix a problem in creating .jsondb dir
jsondb-client saves history in $HOME/.jsondb/history, but it doesn't check if
.jsondb exists or not. Need to create this dir if it is not there yet.
Change-Id: I0ff4ef5376b75f5bd9595093af95fe4f2eac1586
Reviewed-by: Jing Bai <jing.t.bai@nokia.com>
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/jsondb-client/client.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/jsondb-client/client.cpp b/tools/jsondb-client/client.cpp index 12cfe6de..8da864ba 100644 --- a/tools/jsondb-client/client.cpp +++ b/tools/jsondb-client/client.cpp @@ -162,7 +162,15 @@ void InputThread::run() exit(-1); } history(hist, &ev, H_SETSIZE, 800); - historyFile = QDir::homePath() + QDir::separator() + QLatin1String(".jsondb/history"); + QString dirName = QDir::homePath() + QDir::separator() + QLatin1String(".jsondb"); + QFileInfo fi(dirName); + if (!fi.exists()) + { + if (!QDir::home().mkdir(".jsondb")) + qWarning() << "Cannot create" << dirName << ". History will not work."; + } + + historyFile = dirName + QDir::separator() + "history"; history(hist, &ev, H_LOAD, historyFile.toLocal8Bit().constData()); el_set(el, EL_HIST, history, hist); el_set(el, EL_BIND, "\t", "tab-key", NULL); |