diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-14 12:03:59 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-14 12:03:59 +0100 |
commit | 925d3bd3159820c0eae356fe4d3af54cb16ae1e3 (patch) | |
tree | 8229c19eb109450ecfed00ea6a13e2618a6c97f1 /common/storage_unqlite.cpp | |
parent | 7cc25005b8c46d1fa783d33def2c6923e8ef8469 (diff) | |
download | sink-925d3bd3159820c0eae356fe4d3af54cb16ae1e3.tar.gz sink-925d3bd3159820c0eae356fe4d3af54cb16ae1e3.zip |
put unqlite db's in their own subdir to avoid name collisions
Diffstat (limited to 'common/storage_unqlite.cpp')
-rw-r--r-- | common/storage_unqlite.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/storage_unqlite.cpp b/common/storage_unqlite.cpp index 5c5ef09..f94643f 100644 --- a/common/storage_unqlite.cpp +++ b/common/storage_unqlite.cpp | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | #include "unqlite/unqlite.h" | 12 | #include "unqlite/unqlite.h" |
13 | 13 | ||
14 | static const char *s_unqliteDir = "/unqlite/"; | ||
15 | |||
14 | class Storage::Private | 16 | class Storage::Private |
15 | { | 17 | { |
16 | public: | 18 | public: |
@@ -36,9 +38,9 @@ Storage::Private::Private(const QString &s, const QString &n, AccessMode m) | |||
36 | db(0), | 38 | db(0), |
37 | inTransaction(false) | 39 | inTransaction(false) |
38 | { | 40 | { |
39 | const QString fullPath(storageRoot + '/' + name); | 41 | const QString fullPath(storageRoot + s_unqliteDir + name); |
40 | QDir dir; | 42 | QDir dir; |
41 | dir.mkdir(storageRoot); | 43 | dir.mkdir(storageRoot + s_unqliteDir); |
42 | 44 | ||
43 | //create file | 45 | //create file |
44 | int openFlags = UNQLITE_OPEN_CREATE; | 46 | int openFlags = UNQLITE_OPEN_CREATE; |
@@ -276,12 +278,12 @@ void Storage::scan(const char *keyData, uint keySize, | |||
276 | 278 | ||
277 | qint64 Storage::diskUsage() const | 279 | qint64 Storage::diskUsage() const |
278 | { | 280 | { |
279 | QFileInfo info(d->storageRoot + '/' + d->name); | 281 | QFileInfo info(d->storageRoot + s_unqliteDir + d->name); |
280 | return info.size(); | 282 | return info.size(); |
281 | } | 283 | } |
282 | 284 | ||
283 | void Storage::removeFromDisk() const | 285 | void Storage::removeFromDisk() const |
284 | { | 286 | { |
285 | QFile::remove(d->storageRoot + '/' + d->name); | 287 | QFile::remove(d->storageRoot + s_unqliteDir + d->name); |
286 | } | 288 | } |
287 | 289 | ||