diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-12 16:15:34 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-12 17:18:18 +0200 |
commit | 6a3bf46334fc4136da480287898d3f19c88261ee (patch) | |
tree | bfdf4a3050974baa0ce5862930de4f9fcdbd13b7 /common/definitions.cpp | |
parent | 076ae4c6bec75b081fec9cdc7a84d82ffcadc94f (diff) | |
download | sink-6a3bf46334fc4136da480287898d3f19c88261ee.tar.gz sink-6a3bf46334fc4136da480287898d3f19c88261ee.zip |
Avoid redoing stuff over and over that we can easily avoid.
Diffstat (limited to 'common/definitions.cpp')
-rw-r--r-- | common/definitions.cpp | 11 |
1 files changed, 7 insertions, 4 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 | } |