From 6a3bf46334fc4136da480287898d3f19c88261ee Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 12 May 2017 16:15:34 +0200 Subject: Avoid redoing stuff over and over that we can easily avoid. --- common/storage/entitystore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'common/storage') 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 { public: Private(const ResourceContext &context, const Sink::Log::Context &ctx) : resourceContext(context), logCtx(ctx.subContext("entitystore")) { - - if (!QDir().mkpath(entityBlobStorageDir())) { - SinkWarningCtx(logCtx) << "Failed to create the directory: " << entityBlobStorageDir(); + static bool initialized = false; + if (!initialized) { + if (QDir{}.mkpath(entityBlobStorageDir())) { + initialized = true; + } else { + SinkWarningCtx(logCtx) << "Failed to create the directory: " << entityBlobStorageDir(); + } } } -- cgit v1.2.3