From ed3766450ad2f29a73c05753be9a1563377b52fc Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 11 May 2017 13:04:35 +0200 Subject: Calling mkpath once is enough --- common/definitions.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/definitions.cpp b/common/definitions.cpp index 3fc4700..4bf3da4 100644 --- a/common/definitions.cpp +++ b/common/definitions.cpp @@ -40,10 +40,12 @@ QString Sink::configLocation() QString Sink::temporaryFileLocation() { - auto path = dataLocation() + "/temporaryFiles"; - //FIXME create in a singleton on startup? - QDir dir; - dir.mkpath(path); + static auto path = dataLocation() + "/temporaryFiles"; + static bool initialized = false; + if (!initialized) { + QDir{}.mkpath(path); + initialized = true; + } return path; } -- cgit v1.2.3