diff options
-rw-r--r-- | common/definitions.cpp | 11 | ||||
-rw-r--r-- | common/storage/entitystore.cpp | 10 |
2 files changed, 14 insertions, 7 deletions
diff --git a/common/definitions.cpp b/common/definitions.cpp index 4bf3da4..7f4fbbe 100644 --- a/common/definitions.cpp +++ b/common/definitions.cpp | |||
@@ -30,12 +30,14 @@ QString Sink::storageLocation() | |||
30 | 30 | ||
31 | QString Sink::dataLocation() | 31 | QString Sink::dataLocation() |
32 | { | 32 | { |
33 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink"; | 33 | static auto location = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink"; |
34 | return location; | ||
34 | } | 35 | } |
35 | 36 | ||
36 | QString Sink::configLocation() | 37 | QString Sink::configLocation() |
37 | { | 38 | { |
38 | return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/sink"; | 39 | static auto location = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/sink"; |
40 | return location; | ||
39 | } | 41 | } |
40 | 42 | ||
41 | QString Sink::temporaryFileLocation() | 43 | QString Sink::temporaryFileLocation() |
@@ -43,8 +45,9 @@ QString Sink::temporaryFileLocation() | |||
43 | static auto path = dataLocation() + "/temporaryFiles"; | 45 | static auto path = dataLocation() + "/temporaryFiles"; |
44 | static bool initialized = false; | 46 | static bool initialized = false; |
45 | if (!initialized) { | 47 | if (!initialized) { |
46 | QDir{}.mkpath(path); | 48 | if (QDir{}.mkpath(path)) { |
47 | initialized = true; | 49 | initialized = true; |
50 | } | ||
48 | } | 51 | } |
49 | return path; | 52 | return path; |
50 | } | 53 | } |
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index d2161a6..6ff700e 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -96,9 +96,13 @@ class EntityStore::Private { | |||
96 | public: | 96 | public: |
97 | Private(const ResourceContext &context, const Sink::Log::Context &ctx) : resourceContext(context), logCtx(ctx.subContext("entitystore")) | 97 | Private(const ResourceContext &context, const Sink::Log::Context &ctx) : resourceContext(context), logCtx(ctx.subContext("entitystore")) |
98 | { | 98 | { |
99 | 99 | static bool initialized = false; | |
100 | if (!QDir().mkpath(entityBlobStorageDir())) { | 100 | if (!initialized) { |
101 | SinkWarningCtx(logCtx) << "Failed to create the directory: " << entityBlobStorageDir(); | 101 | if (QDir{}.mkpath(entityBlobStorageDir())) { |
102 | initialized = true; | ||
103 | } else { | ||
104 | SinkWarningCtx(logCtx) << "Failed to create the directory: " << entityBlobStorageDir(); | ||
105 | } | ||
102 | } | 106 | } |
103 | } | 107 | } |
104 | 108 | ||